Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6360 closed defect (fixed)

ogr2ogr SIGSEGV when using SQLITE dialect with sqlite 3.10

Reported by: andrewharvey Owned by: warmerdam
Priority: normal Milestone: 1.11.5
Component: default Version: unspecified
Severity: normal Keywords:
Cc: Bas Couwenberg

Description (last modified by andrewharvey)

I'm using Debian sid

  • gdal-bin 1.11.3+dfsg-2+b4 (but also tested with gdal 2.0.2 which also has the same issue)
  • sqlite3 3.10.2-1
  • spatialite 4.3.0a-5

when I use -dialect sqlite and run an -sql query, ogr2ogr is terminated by signal SIGSEGV (Address boundary error).

Full stack trace below

root@ogr:~# gdb --args ogr2ogr -f "GeoJSON" centroids.geojson -dialect sqlite -sql "SELECT ST_Centroid(geometry) from ne_110m_admin_0_countries" ne_110m_admin_0_countries.shp
GNU gdb (Debian 7.10-1+b1) 7.10

(gdb) run
Starting program: /usr/bin/ogr2ogr -f GeoJSON centroids.geojson -dialect sqlite -sql SELECT\ ST_Centroid\(geometry\)\ from\ ne_110m_admin_0_countries ne_110m_admin_0_countries.shp

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007fffe63bf621 in sqlite3OsCurrentTimeInt64 (pVfs=<optimized out>, pTimeOut=0x6978a8) at sqlite3.c:17851
#2  0x00007fffe63c593b in sqlite3StmtCurrentTime (p=0x6987d8, p=0x6987d8) at sqlite3.c:72494
#3  setDateTimeToCurrent (context=context@entry=0x6987d8, p=0x7fffffffb0a0, p=0x7fffffffb0a0) at sqlite3.c:16746
#4  0x00007fffe63ddb09 in parseDateOrTime (p=0x7fffffffb0a0, zDate=0x630758 "now", context=0x6987d8) at sqlite3.c:16782
#5  isDate (context=0x6987d8, argc=1, argv=0x698810, p=0x7fffffffb0a0) at sqlite3.c:17231
#6  0x00007fffe63df394 in strftimeFunc (context=0x6987d8, argc=2, argv=0x698808) at sqlite3.c:17356
#7  0x00007fffe641b7d8 in sqlite3VdbeExec (p=p@entry=0x6977e8) at sqlite3.c:75383
#8  0x00007fffe6425027 in sqlite3Step (p=0x6977e8) at sqlite3.c:72358
#9  sqlite3_step (pStmt=<optimized out>) at sqlite3.c:6883
#10 0x00007fffed7295d9 in updateSpatiaLiteHistory (p_sqlite=p_sqlite@entry=0x6567c8, 
    table=table@entry=0x7fffed9a4f14 "spatial_ref_sys", geom=geom@entry=0x0, 
    operation=operation@entry=0x7fffed9a4ef9 "table successfully created") at metatables.c:207
#11 0x00007fffed702902 in fnct_InitSpatialMetaData (context=0x697108, argc=<optimized out>, argv=<optimized out>) at spatialite.c:1997
#12 0x00007fffe641b7d8 in sqlite3VdbeExec (p=p@entry=0x696818) at sqlite3.c:75383
#13 0x00007fffe6425027 in sqlite3Step (p=0x696818) at sqlite3.c:72358
#14 sqlite3_step (pStmt=<optimized out>) at sqlite3.c:6883
#15 0x00007fffe642607a in sqlite3_exec (db=0x6567c8, zSql=<optimized out>, xCallback=0x0, pArg=0x0, pzErrMsg=0x7fffffffe2d8)
    at sqlite3.c:104925
#16 0x00007ffff7764f66 in ?? () from /usr/lib/libgdal.so.1
#17 0x00007ffff776aa8e in ?? () from /usr/lib/libgdal.so.1
#18 0x000000000040600d in ?? ()
#19 0x00007ffff6170870 in __libc_start_main (main=0x404cd0, argc=9, argv=0x7fffffffebf8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffebe8) at libc-start.c:291
#20 0x0000000000408649 in ?? ()
(gdb) 

Change History (6)

comment:1 by andrewharvey, 8 years ago

Description: modified (diff)

comment:2 by Even Rouault, 8 years ago

Cc: Bas Couwenberg added
Milestone: 1.11.5
Resolution: fixed
Status: newclosed

CC'ing Bas as he may need to apply this patch:

trunk r33410, branches/2.0 r33411, branches/1.11 r33412 "SQLite: fix crash on Unix systems with SQLite >= 3.10.0 when xCurrentTimeInt function is called (#6360)"

comment:3 by Bas Couwenberg, 8 years ago

Thanks for the CC, I've added the patch to the Debian packaging for 1.11.3 (unstable), 1.11.4 (experimental) and 2.0.2 (not in the archive yet). I'll prepare new builds for unstable & experimental tonight.

comment:4 by Bas Couwenberg, 8 years ago

gdal (1.11.3+dfsg-3) is now available in unstable and gdal (1.11.4+dfsg-1~exp2) in experimental with the fix for this issue.

Ubuntu has gdal (1.11.3+dfsg-3) in proposed for xenial, hopefully they won't stall moving it to release like grass (7.0.3-1) & netcdf (1:4.4.0-1) and their related packages.

comment:5 by andrewharvey, 8 years ago

Upgraded my packages and now it's working. Thanks, you guys are awesome!

comment:6 by Even Rouault, 8 years ago

Summary: ogr2ogr SIGSEGV when using SQLITE dialectogr2ogr SIGSEGV when using SQLITE dialect with sqlite 3.10
Note: See TracTickets for help on using tickets.