[gdal-dev] OGR_L_SetFeature() randomly crashes with EXC_BAD_ACCESS in sqlite3

Even Rouault even.rouault at spatialys.com
Fri Mar 24 06:50:14 PDT 2017


On vendredi 24 mars 2017 20:33:31 CET Nik Sands wrote:
> Hello dev list,
> 
> I’m using GDAL 2.1.2 in an iOS app (statically linked).  When executing
> OGR_L_SetFeature() it usually works fine, but randomly crashes with
> EXC_BAD_ACCESS.
> 
> The crash is in sqlite3 and appears to be due to dereferencing a NULL
> pointer, as far as I can tell from the back trace.
> 
> In my app, the crash occurs when I call, "OGR_L_SetFeature(layer, feature)”,
> at which point both “layer” and “feature” are non-NULL, and the layer is in
> a GeoPackage data source.
> 
> The top of the back trace is:
> 
> MyApp`sqlite3_clear_bindings(pStmt=0x0000000000000000) + 24 at
> sqlite3.c:75797, queue = 'com.apple.main-thread', stop reason =
> EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000010012684c
> MyApp`sqlite3_clear_bindings(pStmt=0x0000000000000000) + 24 at
> sqlite3.c:75797 [opt] frame #1: 0x00000001005c0770
> MyApp`OGRGeoPackageTableLayer::ISetFeature(this=0x000000010134af10,
> poFeature=0x0000000174097750) + 440 at ogrgeopackagetablelayer.cpp:1441
> [opt] * frame #2: 0x00000001000b0074 MyApp`-[VectorFeature
> syncToDisk](self=0x000000017422cd00, _cmd="syncToDisk") + 92 at
> VectorFeature.m:56
> 
> I don’t know enough about the SQLite or GeoPackage code to make any sensible
> progress on this.  Can somebody please point me in the right direction to
> figure out what I’m doing wrong?

I've reviewed the code inf the GPKG driver and can't find anything wrong in it just with that. 
Particularly I can't see how the pStmt can be NULL at  the point where sqlite3_clear_bindings 
is called.

Is your issue really random ? If so; that might be a memory corruption elsewhere. If so, I 
would run valgrind on your code (I know it is available on the Mac, but perhaps not on iOS) on 
a debug version.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170324/d791210a/attachment.html>


More information about the gdal-dev mailing list