You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A crash occures in the Firebird odbc driver when I execute the following statements:
r = SQLPrepare(hstmt, (SQLCHAR*)"INSERT INTO test (id, text) VALUES (1, ?)", SQL_NTS); // test.text is a CHAR column
int value = 1;
r = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &value, 0, 0); // binds INTEGER value to CHAR column
r = SQLExecute(hstmt); // crashs
A debugging session revealed that the crash occurres in
OdbcConvert::conv##TYPE_FROM##ToString(DescRecord * from, DescRecord * to)
when the ODBCCONVERT_CHECKNULL macro gets called.
The indicatorFrom variable has a 0 value (from last parameter of SQLBindParameter, which is valid according to MSDN) and gets dereferenced in this macro:
Submitted by: Sven Steinseifer (svensteinseifer)
A crash occures in the Firebird odbc driver when I execute the following statements:
r = SQLPrepare(hstmt, (SQLCHAR*)"INSERT INTO test (id, text) VALUES (1, ?)", SQL_NTS); // test.text is a CHAR column
int value = 1;
r = SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &value, 0, 0); // binds INTEGER value to CHAR column
r = SQLExecute(hstmt); // crashs
A debugging session revealed that the crash occurres in
OdbcConvert::conv##TYPE_FROM##ToString(DescRecord * from, DescRecord * to)
when the ODBCCONVERT_CHECKNULL macro gets called.
The indicatorFrom variable has a 0 value (from last parameter of SQLBindParameter, which is valid according to MSDN) and gets dereferenced in this macro:
#define ODBCCONVERT_CHECKNULL(pointerTo) \
if( *(short*)indicatorFrom == SQL_NULL_DATA ) \
{ \
if ( indicatorTo ) \
*indicatorTo = SQL_NULL_DATA; \
if ( pointerTo ) \
*(char*)pointerTo = 0; \
return SQL_SUCCESS; \
} \
if ( !pointerTo ) \
return SQL_SUCCESS;
If I change this to the following, the crash disappears:
#define ODBCCONVERT_CHECKNULL(pointerTo) \
if( indicatorFrom && *(short*)indicatorFrom == SQL_NULL_DATA ) \
{ \
if ( indicatorTo ) \
*indicatorTo = SQL_NULL_DATA; \
if ( pointerTo ) \
*(char*)pointerTo = 0; \
return SQL_SUCCESS; \
} \
if ( !pointerTo ) \
return SQL_SUCCESS;
Because this macro is used very often, I cannot be sure, if this doesn't introduce some other bugs.
Commits: b994cee 6122325
The text was updated successfully, but these errors were encountered: