#638974 libsqlite3-dev: A call to sqlite3_open() gives a SIGSEGV

Package:
libsqlite3-dev
Source:
sqlite3
Description:
SQLite 3 development files
Submitter:
Mark Caglienzi
Date:
2015-07-14 09:42:09 UTC
Severity:
important
#638974#5
Date:
2011-08-23 13:01:34 UTC
From:
To:
I'm using this library to develop an application.
But as soon as I make a call to sqlite3_open() to open a database,
I receive a SIGSEGV.

Please note that I followed the basic tutorial (written in the docs and the
upstream website) about opening a database, and the code I already written
behaves correctly. But, as soon as I add:

sqlite3 *db;
sqlite3_open ("filename", &db);

I receive a Segmentation Fault.

Running my program under gdb, setting a breakpoint on sqlite3_open and doing a
backtrace, this is what I receive:


[Thread debugging using libthread_db enabled]

Program received signal SIGSEGV, Segmentation fault.
malloc_consolidate (av=<value optimized out>) at malloc.c:5155
5155    malloc.c: No such file or directory.
        in malloc.c
(gdb) backtrace
#0  malloc_consolidate (av=<value optimized out>) at malloc.c:5155
#1  0xb7e37035 in _int_malloc (av=<value optimized out>, bytes=<value optimized
out>) at malloc.c:4373
#2  0xb7e394ac in __libc_malloc (bytes=536) at malloc.c:3660
#3  0xb7f50bfb in ?? () from /usr/lib/libsqlite3.so.0
#4  0xb7f2e75e in ?? () from /usr/lib/libsqlite3.so.0
#5  0xb7f36891 in ?? () from /usr/lib/libsqlite3.so.0
#6  0xb7f37184 in ?? () from /usr/lib/libsqlite3.so.0
#7  0xb7fa65ca in ?? () from /usr/lib/libsqlite3.so.0
#8  0x08048d16 in main (argc=4, argv=0xbffff504) at test.c:77


If I comment out the sqlite3 call, everything works fine.

Regards,
Mark

#638974#10
Date:
2015-07-14 00:58:16 UTC
From:
To:
FYI:
1) I was able to reproduce this bug in jessie's 3.8.7.1 (gdb and
valgrind report attached);
2) I was *NOT* able to reproduce it in (self-backported) sid's
3.8.10.2-1 (and running under valgrind does not show any problem).
[fwiw, test.db created sid {totally expectdly} kills jessie's on attempt
to open it].
However, I have not found respective entry in changelogs (or upstream
commit), so this could be false positive.

#638974#15
Date:
2015-07-14 08:23:38 UTC
From:
To:
Hi,
 Your issue is quite different from the one you sent this followup
for. The gdb report is missing, but it would be useful for upstream,
not me. :(
 It can be an old upstream bug. If you have time, you may try to find
the commit which fixes this from the upstream repository. From the
valgrind output it seems you execute: 'sqlite3 test.db "CREATE TABLE t
( x UNIQUE PRIMARY KEY ) WITHOUT ROWID;"'. The root cause can be that
'primary key' is an alias of 'unique'[1] (point 3.0, second
paragraph). At least the solution to drop the "double" 'unique'
statement and just use 'sqlite3 test.db "CREATE TABLE t ( x PRIMARY
KEY ) WITHOUT ROWID;"'.

Regards,
Laszlo/GCS
[1] https://www.sqlite.org/withoutrowid.html

#638974#20
Date:
2015-07-14 09:39:40 UTC
From:
To:
Oops, sorry, I somehow mixed numbers, that should have been sent as
followup to #736463 :-( #638974 is, indeed, unrelated.