Bug #103664 SQLColAttribute SQL_DESC_TYPE_NAME sporadic junk data
Submitted: 11 May 19:04 Modified: 12 May 4:35
Reporter: Farid Zidan (Candidate Quality Contributor) Email Updates:
Status: Analyzing Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:8.0.24 ANSI 64-bit OS:Microsoft Windows
Assigned to: MySQL Verification Team CPU Architecture:x86

[11 May 19:04] Farid Zidan
Description:
Randomly gets junk data for SQLColAttribute SQL_DESC_TYPE_NAME for the same resultset columns on different calls.

        // type_name
        nLen = SQL_NULL_DATA;
        memset(pRow->type_name, 0, sizeof(pRow->type_name));
        rc = SQLColAttribute(
                hstmt,
                nCol,
                SQL_DESC_TYPE_NAME,
                pRow->type_name,
                sizeof(pRow->type_name),
                &nLen,
                NULL);

How to repeat:
Call SQLColAttribute SQL_DESC_TYPE_NAME for a resultset, you get different junk data randomly sporadically.

With CompareData app (www.zidsoft.com)
1 Create MySQL 8 ODBC data source (ANSI)
2 Use the app data source repository wizard to create the app repository on the data source
3 Add a DBMS comparison for the data source to itself.
4 Perform columns comparison for the Tables tree item
6 observe junk data as differences between the table column data types for the same data source table/columns.

Suggested fix:
Driver appears to reference memory that is deallocated to copy the data name to the result buffer.
[11 May 19:11] Farid Zidan
Sample screen shot of junk data comparing table columns to itself

Attachment: mysql_odbc.jpg (image/jpeg, text), 1.31 MiB.

[11 May 19:26] Farid Zidan
This is tested with the 64-bit version of the driver.