You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2023/11/23 19:06:06 UTC

(sis) 03/04: fix(Shapefile): fix integer overflow on large dbf files

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 210f3ff99c48ab474d43adfd6197e384b3c995b4
Author: jsorel <jo...@geomatys.com>
AuthorDate: Thu Nov 23 16:04:56 2023 +0100

    fix(Shapefile): fix integer overflow on large dbf files
---
 .../main/org/apache/sis/storage/shapefile/ShapefileStore.java          | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
index 1e9029216b..64276679b1 100644
--- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
+++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java
@@ -392,7 +392,8 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe
                             final ShapeRecord shpRecord = shpreader.next();
                             if (shpRecord == null) return false;
                             //move dbf to record offset, some shp record might have been skipped because of filter
-                            dbfreader.moveToOffset(header.headerSize + (shpRecord.recordNumber-1) * header.recordSize);
+                            long offset = (long)header.headerSize + ((long)(shpRecord.recordNumber-1)) * ((long)header.recordSize);
+                            dbfreader.moveToOffset(offset);
                             final DBFRecord dbfRecord = dbfreader.next();
                             final Feature next = type.newInstance();
                             next.setPropertyValue(GEOMETRY_NAME, shpRecord.geometry);