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

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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 6a8d5b9ba6 fix(Shapefile): fix integer overflow on large dbf files
6a8d5b9ba6 is described below

commit 6a8d5b9ba60dc7ad60f233fbd9d1fee3d20273d1
Author: jsorel <johann.so...@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 f17560575a..649006acf1 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
@@ -393,7 +393,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);

Reply via email to