Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#5608 closed defect (fixed)

Cannot read last record of shapefile

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 2.0.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: shape
Cc:

Description

There are shapefiles in the wild whose .shx has content length field that is not equal to the content length field of the .shp, which is a clear violation of "The content length stored in the index record is the same as the value stored in the main file record header." (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf, page 24) Actually in that case the .shx content length is equal to the .shp content length + 4 (16 bit words), representing the 8 bytes of the record header...

Some software are robust to that because they only take into account the offset of the .shx and then read the 8 bytes of the shape header to find the content length. Some are also robust to that probably because they don't check the return value of the fread()...

Change History (4)

comment:1 Changed 7 years ago by Even Rouault

trunk r27577 "Shape: fix reading of shapefiles whose .shx is non conformant (the content length of records is different from the one in the .shp) (#5608)"

comment:2 Changed 7 years ago by Jukka Rahkonen

At least part of those shapefiles in the wild are created with shapelib versions below 1.2.7 http://shapelib.maptools.org/release.html

comment:3 Changed 7 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: newclosed

comment:4 Changed 6 years ago by Even Rouault

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.