[gdal-dev] Crash: [GDAL 1.10dev] empty shapefile with spatial index

Dennis Gocke dengo at gmx.net
Fri Apr 5 00:55:31 PDT 2013


Hi,

I've encountered a serious problem with an empty shapefile (no features)
that already has sbn, sbx files generated. When trying to create a feature
there is an Access Violation and the program crashes without any chance to
catch the exception.
The shapefile was exported with ArcCatalog, but the same happens when
creating an empty shapefile with OGR and then creating spatial index on it
with ArcCatalog.

Trying "DROP SPATIAL INDEX ON.." in OGR also produces the same crash.

When manually deleting the sbn, sbx files before opening the shapefile with
OGR, everything works fine.

I am using the C# wrapper, but I am sure the problem is in OGR itself.
The lines that can be used to reproduce the crash:

DataSource ds = Ogr.Open(@"D:\test\IndustryA_O.shp", 1);
Layer layer = ds.GetLayerByIndex(0);
FeatureDefn featureDefn = layer.GetLayerDefn();
Feature newFeature = new Feature(featureDefn);
layer.CreateFeature(newFeature);  // <-- Crash

Using GDAL 1.9.2 does not produce the crash, but this was to be expected
because 1.9.2 just ignores the spatial index.

I've also attached the shapefile. Hopefully this works with the mailing
list.

Regards,
Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130405/429fe89e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Crash_Empty_Shapefile_SpatialIndex.zip
Type: application/zip
Size: 1290 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130405/429fe89e/attachment.zip>


More information about the gdal-dev mailing list