[gdal-dev] QGIS crashes in ogrsqlitevirtualogr.cpp::OGR2SQLITE_Register

Kyle Shannon kyle at pobox.com
Thu Dec 4 14:04:56 PST 2014


Sandro,

On Thu, Dec 4, 2014 at 2:50 PM, Sandro Mani <manisandro at gmail.com> wrote:
> Hi,
>
> QGIS is currently crashing in Fedora 21+ when listing the supported ogr
> drivers. In QgsVectorFileWriter::ogrDriverList, there is a portion of code
>
> // Unfortunately it seems that there is no simple way to detect if
> // OGR SQLite driver is compiled with SpatiaLite support.
> // We have HAVE_SPATIALITE in QGIS, but that may differ from OGR
> // http://lists.osgeo.org/pipermail/gdal-dev/2012-November/034580.html
> // -> test if creation failes
> [...]
> OGRDataSourceH ds = OGR_Dr_CreateDataSource( poDriver, TO8F( QString(
> "/vsimem/spatialitetest.sqlite" ) ), options );
>
> which then (see stack trace below) ends up calling OGR2SQLITE_Register,
> which itself calls sqlite3_auto_extension which is a macro defined as
> sqlite3_api->auto_extension. This last call crashes because sqlite3_api is
> null.
>
> Reading the code it looks like the only way for sqlite3_api to be
> initialized is via ogrsqlitevirtualogr.cpp::sqlite3_extension_init, which is
> supposedly called when loading the extension via SQLite. I don't see
> sqlite3_extension_init being called otherwise, so I wonder whether this is a
> bug in ogr, or whether QGIS is doing something it shouldn't.
>
> The backtrace is:
>
> (gdb) bt
> #0  0x00007ffff4ad36ce in OGR2SQLITE_Register() () at
> ogrsqlitevirtualogr.cpp:2460
> #1  0x00007ffff4ab0148 in OGRSQLiteDataSource::OpenOrCreateDB(int)
> (this=this at entry=0x4278780, flags=flags at entry=6) at
> ogrsqlitedatasource.cpp:455
> #2  0x00007ffff4ab473e in OGRSQLiteDataSource::Create(char const*, char**)
> (this=this at entry=0x4278780, pszNameIn=pszNameIn at entry=0x42786d8
> "/vsimem/spatialitetest.sqlite", papszOptions=papszOptions at entry=0x1e695d0)
> at ogrsqlitedatasource.cpp:610
> #3  0x00007ffff4ab8666 in OGRSQLiteDriver::CreateDataSource(char const*,
> char**) (this=<optimized out>, pszName=0x42786d8
> "/vsimem/spatialitetest.sqlite", papszOptions=0x1e695d0)
>     at ogrsqlitedriver.cpp:203
> #4  0x00007ffff4aa5f82 in OGR_Dr_CreateDataSource(OGRSFDriverH, char const*,
> char**) (hDriver=0x11f4b80, pszName=<optimized out>, papszOptions=<optimized
> out>) at ogrsfdriver.cpp:74
> #5  0x00007ffff3d2477e in QgsVectorFileWriter::ogrDriverList() () at
> /usr/src/debug/qgis-2.6.0/src/core/qgsvectorfilewriter.cpp:2127
>
> (gdb) frame 0
> #0  0x00007ffff4ad36ce in OGR2SQLITE_Register () at
> ogrsqlitevirtualogr.cpp:2460
> 2460        sqlite3_auto_extension ((void (*)(void))
> OGR2SQLITE_static_register);
>
> (gdb) print sqlite3_api
> $1 = (const sqlite3_api_routines *) 0x0
>
>
> Thanks for any inputs.
>
> Best,
> Sandro
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

It looks like this may be the issue:
http://trac.osgeo.org/gdal/ticket/5725, and a fix has been committed.
I think this has to do with more recent versions of sqlite.  What
version are you using?

-- 
Kyle


More information about the gdal-dev mailing list