Opened 13 years ago

Last modified 13 years ago

#1211 closed defect (fixed)

GetNextFeature crashes in 1.3.2 for shapefile with no fields

Reported by: rengelkemeir@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SF Version: unspecified
Severity: normal Keywords:


The shapefile in question has a .dbf file, but has no fields in it.
In earlier version I was able to read this file properly and obtain the geometry.
With 1.3.2 version GetNextFeature crashes in DBFIsRecordDeleted since hDBF is NULL.
Not quite sure what best solution would be.
Should DBFIsRecordDeleted return FALSE if DBFHandle is NULL?
Or should DBFIsRecordDeleted be called only if have valid handle?
OGRShapeLayer::GetNextFeature() and OGRShapeLayer::Repack() would work fine with
FALSE return (Repack would do nothing), but looks like
OGRShapeLayer::DeleteFeature() would later crash in DBFMarkRecordDeleted.

Change History (2)

comment:1 Changed 13 years ago by warmerdam


I have made some modifications to gdal/ogr/ogrsf_frmts/shape/shape2ogr.cpp
and ogrshapelayer.cpp to handle the hDBF == NULL case.  I also added an
extra test for this case in gdalautotest/ogr/ 

Changes are all in CVS.

comment:2 Changed 13 years ago by rengelkemeir@…

Frank's fix takes care of the problem.
Note: See TracTickets for help on using tickets.