SQLProcedures() and SQLTables() dying unexpectedly with any input

Matt Grimm <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAG4_kQtB7i87tTxe6b_0ezKyyh6kVr3xED3DNaRcrLXjk=+yKw@mail.gmail.com>
Hello,

I'm having trouble with a few ODBC functions dying in nasty ways when I
call them with any of a variety of parameters. I can reproduce the problem
in a simple test script that does nothing more than set up a connection and
a statement handle and call the info function. This is on 32-bit Linux
(RHEL 5.4) with FreeTDS 0.91 and unixODBC 2.3.1.  I'm connecting to a SQL
Server 2008 instance.

SQLProcedures()/SQLProceduresW() are segfaulting and
SQLTables()/SQLTablesW() are aborting with an assertion failure. Details
below.

Any insight you can provide is appreciated,
m.

--------------------------------------------------------------------------------
SQLProceduresW():

    Command line output:
        Segmentation fault (core dumped)

    Backtrace from core dump:
        Program terminated with signal 11, Segmentation fault.
        [New process 17346]
        #0  0x00e49177 in tds_quote (tds=<value optimized out>, buffer=0x0,
quoting=93 ']', id=0x0, len=1) at query.c:2185
        2185    query.c: No such file or directory.
                in query.c
        (gdb) bt
        #0  0x00e49177 in tds_quote (tds=<value optimized out>, buffer=0x0,
quoting=93 ']', id=0x0, len=1) at query.c:2185
        #1  0x00e226a8 in odbc_stat_execute (stmt=0x829d6e8, begin=0xe5dac6
"..sp_stored_procedures", nparams=3) at odbc.c:7049
        #2  0x00e2389a in SQLProcedures (hstmt=0x829d6e8,
szCatalogName=0x8048b74 "f", cbCatalogName=4, szSchemaName=0x8048b74 "f",
cbSchemaName=4, szProcName=0x8048b74 "f", cbProcName=4) at odbc.c:1081
        #3  0x00bcf143 in SQLProcedures (statement_handle=0x829d810,
sz_catalog_name=0x8048b74 "f", cb_catalog_name=<value optimized out>,
sz_schema_name=0x8048b74 "f", cb_schema_name=<value optimized out>,
sz_proc_name=0x8048b74 "f", cb_proc_name=<value optimized out>)
            at SQLProcedures.c:335
        #4  0x080489db in main (argc=4, argv=0xbff77764) at
sqlgetprocedures_test.c:104

--------------------------------------------------------------------------------
SQLTablesW():

    Command line output:
        sqlgettables_test: odbc.c:7089: odbc_stat_execute: Assertion `p -
proc + 1 <= len' failed.
        Aborted (core dumped)

    Backtrace from core dump:
        Program terminated with signal 6, Aborted.
        [New process 19404]
        #0  0x00cd9402 in __kernel_vsyscall ()
        (gdb) bt
        #0  0x00cd9402 in __kernel_vsyscall ()
        #1  0x005addf0 in raise () from /lib/libc.so.6
        #2  0x005af701 in abort () from /lib/libc.so.6
        #3  0x005a726b in __assert_fail () from /lib/libc.so.6
        #4  0x0015a969 in odbc_stat_execute (stmt=0x8c0d6e8, begin=0x195904
"..sp_tables", nparams=4) at odbc.c:7089
        #5  0x0015ace8 in SQLTables (hstmt=0x8c0d6e8,
szCatalogName=0x8bfd190 "d", cbCatalogName=7, szSchemaName=0x8bdb508 "d",
cbSchemaName=3, szTableName=0x8bdb518 "%\201l", cbTableName=1,
szTableType=0x8bdbc00 "\220\201l", cbTableType=0) at odbc.c:6792
        #6  0x00e2dfd2 in SQLTablesW (statement_handle=0x8c0d810,
catalog_name=0x8048b90, name_length1=7, schema_name=0x8048b80,
name_length2=<value optimized out>, table_name=0x8048b78, name_length3=1,
table_type=0x8048b74, name_length4=0) at SQLTablesW.c:327
        #7  0x080489dd in main (argc=4, argv=0xbfc82ee4) at
sqlgettables_test.c:103
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.