[unixODBC-support] SQLGetFunctions() call with null SupportedPtr dumps core

G, Hemanth Kumar Hemanth.G at Teradata.com
Fri May 22 06:29:58 BST 2009


Hi

     I am trying to get Teradata driver work with unixODBC driver
manager. Compiled and linked the driver with unixODBC and able to
connect to the Database successfully.
With many of our testcases passing, I observe some of them dumping core.

To mention few --->

______________________________________________________________________

SQLGetFunctions() call with a null SupportedPtr aborts, giving core
dump.

rc = SQLGetFunctions(hdbc, SQL_API_SQLCONNECT, NULL);

Trace from gdb
----------------------
#0  0x77f63a72 in __check_for_function (connection=0x403810,
function_id=7,
    supported=0x0) at SQLConnect.c:2677
2677            *supported = SQL_FALSE;
(gdb) where
#0  0x77f63a72 in __check_for_function (connection=0x403810,
function_id=7,
    supported=0x0) at SQLConnect.c:2677
#1  0x77f79e76 in SQLGetFunctions (connection_handle=0x403810,
function_id=7,
    supported=0x0) at SQLGetFunctions.c:171
#2  0x004011ea in main (argc=1, argv=0x7fadb044) at adhoc.c:201

Driver Manager Trace
-------------------------------
[ODBC][5275][1242969376.294506][SQLGetFunctions.c][147]
                Entry:
                        Connection = 0x403810
                        Id = SQLConnect
                        Supported = (nil)
________________________________________________________________________


________________________________________________________________________

SQLGetInfo() call with a null InfoValuePtr aborts with a core dump.

rc = SQLGetInfo(hdbc, SQL_DRIVER_HSTMT, NULL, 300, &dblen);

Trace taken from gdb
-------------------------------
#0  0x77f7a224 in __SQLGetInfo (connection_handle=0x403810, info_type=5,
    info_value=0x0, buffer_length=300, string_length=0x7fe70eea) at
SQLGetInfo.c:263
263                 DMHSTMT hstmt = *((DMHSTMT*) info_value);
(gdb) where
#0  0x77f7a224 in __SQLGetInfo (connection_handle=0x403810, info_type=5,
    info_value=0x0, buffer_length=300, string_length=0x7fe70eea) at
SQLGetInfo.c:263
#1  0x77f7ae4e in SQLGetInfo (connection_handle=0x403810, info_type=5,
info_value=0x0,
    buffer_length=300, string_length=0x7fe70eea) at SQLGetInfo.c:599
#2  0x0040121e in main (argc=1, argv=0x7fe71044) at adhoc.c:206

Driver Manager Trace
------------------------------
[ODBC][5290][1242969573.838511][SQLGetInfo.c][546]
                Entry:
                        Connection = 0x403810
                        Info Type = SQL_DRIVER_HSTMT (5)
                        Info Value = (nil)
                        Buffer Length = 300
                        StrLen = 0x7fe70eea
________________________________________________________________________


I would suggest, a check is made to verify if the pointers are NULL,
before assigning them or doing any arithmetic with them.

Any other suggestions or help on this is greatly appreciated.

Thanks,
Hemanth.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.unixodbc.org/pipermail/unixodbc-support/attachments/20090522/0994cec0/attachment.html>


More information about the unixODBC-support mailing list