Bug#771669: segfaults with trivial usage
On 12/01/2014 02:38 PM, Lionel Elie Mamane wrote: Hi Christian, May I draw your attention on Debian bug number 771669, which I quote below and which can be read in full at http://bugs.debian.org/771669 ? It was reported against 0.992, but I have reproduced it with 0.999 (which I'm shortly going to upload to Debian). ... Hey Lionel, should be fixed with version 0.9991, please update. Best regards, Christian -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#771669: segfaults with trivial usage
Package: libsqliteodbc Version: 0.992-2 Severity: grave Hello, sqlite3+odbc segfaults with this simple test case, which as far as I understand ODBC is just a standard connect and prepare sequence. The segfault happens in the current Jessie and in Fedora 20. $ cat sqlite-odbc.c #include sql.h #include sqlext.h #include assert.h #include stdlib.h int main() { // Allocate ODBC environment handle and register version SQLHENV od_env; assert(SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, od_env) == SQL_SUCCESS); assert(SQLSetEnvAttr(od_env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0) == SQL_SUCCESS); SQLHDBC od_conn; assert(SQLAllocHandle(SQL_HANDLE_DBC, od_env, od_conn) == SQL_SUCCESS); // Connect to the DSN char sdcout[1024]; SQLSMALLINT outlen; assert(SQLDriverConnect(od_conn, NULL, (SQLCHAR*)Driver=SQLite3;Database=test.sqlite;, SQL_NTS, (SQLCHAR*)sdcout, 1024, outlen, SQL_DRIVER_NOPROMPT) == SQL_SUCCESS); // Create a statement SQLHSTMT stm; assert(SQLAllocHandle(SQL_HANDLE_STMT, od_conn, stm) == SQL_SUCCESS); // Prepare a query assert(SQLPrepare(stm, (SQLCHAR*)SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name=?, SQL_NTS) == SQL_SUCCESS); // All good, deallocate things SQLFreeHandle(SQL_HANDLE_STMT, stm); SQLFreeHandle(SQL_HANDLE_DBC, od_conn); SQLFreeHandle(SQL_HANDLE_ENV, od_env); } $ gcc -g sqlite-odbc.c -o sqlite-odbc -lodbc $ rm -f test.sqlite # Not needed, but it keeps the tests stateless $ ./sqlite-odbc Segmentation fault $ rm -f test.sqlite # Not needed, but it keeps the tests stateless $ gdb ./sqlite-odbc GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 [...] (gdb) run Starting program: /home/enrico/lavori/arpa/dballe/sqlite-odbc [Thread debugging using libthread_db enabled] Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1. Program received signal SIGSEGV, Segmentation fault. 0x76abc537 in sqlite3_stricmp () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (gdb) where #0 0x76abc537 in sqlite3_stricmp () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #1 0x76abd485 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #2 0x76abecf6 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #3 0x76b29188 in sqlite3_table_column_metadata () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #4 0x76d8180d in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #5 0x76d882d0 in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #6 0x76d88965 in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #7 0x77b94481 in SQLPrepare () from /usr/lib/x86_64-linux-gnu/libodbc.so.2 #8 0x00400957 in main () at sqlite-odbc.c:30 (gdb) Regards, Enrico -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libsqliteodbc depends on: ii libc6 2.19-13 ii libsqlite0 2.8.17-12 ii libsqlite3-0 3.8.7.1-1 ii multiarch-support 2.19-13 libsqliteodbc recommends no packages. Versions of packages libsqliteodbc suggests: ii unixodbc-bin 2.3.0-4 -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#771669: segfaults with trivial usage
rename 771669 segfault on SQLPrepare SELECT with expression result column thanks On Mon, Dec 01, 2014 at 02:31:22PM +0200, Enrico Zini wrote: sqlite3+odbc segfaults with this simple test case, which as far as I understand ODBC is just a standard connect and prepare sequence. $ cat sqlite-odbc.c (...) // Prepare a query assert(SQLPrepare(stm, (SQLCHAR*)SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name=?, SQL_NTS) == SQL_SUCCESS); Reproduced; the trigger for this segfault is that a column in the result of the select is an expression, as opposed to a straight column reference from a table. -- Lionel -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#771669: segfaults with trivial usage
Hi Christian, May I draw your attention on Debian bug number 771669, which I quote below and which can be read in full at http://bugs.debian.org/771669 ? It was reported against 0.992, but I have reproduced it with 0.999 (which I'm shortly going to upload to Debian). I also attach a backtrace with sqliteodbc and libsqlite3 compiled in full debug mode. The trigger for this segfault seems to me to be that a column in the result of the select is an expression, as opposed to a straight column reference from a table, leading to sqlite3_column_(database|table|origin)_name to return NULL, which is then passed to sqlite3_table_column_metadata. I'm not 100% sure if that is to be considered a bug in sqliteodbc or in libsqlite3; even if a bug in libsqlite3, it would probably be good to work around it in sqliteodbc, additionally to having it fixed in libsqlite3. Please keep 771...@bugs.debian.org in CC of your replies, so that they are filed by our bug tracking system and forwarded to the right people. Best Regards and Thanks, Lionel Mamane On Mon, Dec 01, 2014 at 02:31:22PM +0200, Enrico Zini wrote: Package: libsqliteodbc Version: 0.992-2 Severity: grave Hello, sqlite3+odbc segfaults with this simple test case, which as far as I understand ODBC is just a standard connect and prepare sequence. The segfault happens in the current Jessie and in Fedora 20. $ cat sqlite-odbc.c #include sql.h #include sqlext.h #include assert.h #include stdlib.h int main() { // Allocate ODBC environment handle and register version SQLHENV od_env; assert(SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, od_env) == SQL_SUCCESS); assert(SQLSetEnvAttr(od_env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0) == SQL_SUCCESS); SQLHDBC od_conn; assert(SQLAllocHandle(SQL_HANDLE_DBC, od_env, od_conn) == SQL_SUCCESS); // Connect to the DSN char sdcout[1024]; SQLSMALLINT outlen; assert(SQLDriverConnect(od_conn, NULL, (SQLCHAR*)Driver=SQLite3;Database=test.sqlite;, SQL_NTS, (SQLCHAR*)sdcout, 1024, outlen, SQL_DRIVER_NOPROMPT) == SQL_SUCCESS); // Create a statement SQLHSTMT stm; assert(SQLAllocHandle(SQL_HANDLE_STMT, od_conn, stm) == SQL_SUCCESS); // Prepare a query assert(SQLPrepare(stm, (SQLCHAR*)SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name=?, SQL_NTS) == SQL_SUCCESS); // All good, deallocate things SQLFreeHandle(SQL_HANDLE_STMT, stm); SQLFreeHandle(SQL_HANDLE_DBC, od_conn); SQLFreeHandle(SQL_HANDLE_ENV, od_env); } $ gcc -g sqlite-odbc.c -o sqlite-odbc -lodbc $ rm -f test.sqlite # Not needed, but it keeps the tests stateless $ ./sqlite-odbc Segmentation fault $ rm -f test.sqlite # Not needed, but it keeps the tests stateless $ gdb ./sqlite-odbc GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1 [...] (gdb) run Starting program: /home/enrico/lavori/arpa/dballe/sqlite-odbc [Thread debugging using libthread_db enabled] Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1. Program received signal SIGSEGV, Segmentation fault. 0x76abc537 in sqlite3_stricmp () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (gdb) where #0 0x76abc537 in sqlite3_stricmp () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #1 0x76abd485 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #2 0x76abecf6 in ?? () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #3 0x76b29188 in sqlite3_table_column_metadata () from /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 #4 0x76d8180d in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #5 0x76d882d0 in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #6 0x76d88965 in ?? () from /usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so #7 0x77b94481 in SQLPrepare () from /usr/lib/x86_64-linux-gnu/libodbc.so.2 #8 0x00400957 in main () at sqlite-odbc.c:30 (gdb) Regards, Enrico -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libsqliteodbc depends on: ii libc6 2.19-13 ii libsqlite0 2.8.17-12 ii libsqlite3-0 3.8.7.1-1 ii multiarch-support 2.19-13 libsqliteodbc recommends no packages. Versions of packages libsqliteodbc suggests: ii unixodbc-bin 2.3.0-4 -- no debconf information Program received signal SIGSEGV, Segmentation fault. 0x76aaa487 in sqlite3_stricmp (zLeft=0x62b758 sqlite_temp_master, zRight=zRight@entry=0x0) at sqlite3.c:23042 23042while( *a!=0 UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } (gdb)
Processed: Re: Bug#771669: segfaults with trivial usage
Processing commands for cont...@bugs.debian.org: retitle 771669 segfault on SQLPrepare SELECT with expression result column Bug #771669 [libsqliteodbc] segfaults with trivial usage Changed Bug title to 'segfault on SQLPrepare SELECT with expression result column' from 'segfaults with trivial usage' thanks Stopping processing here. Please contact me if you need assistance. -- 771669: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771669 Debian Bug Tracking System Contact ow...@bugs.debian.org with problems -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org