Bug #104669 Crash in SQLFetch
Submitted: 19 Aug 2021 20:09 Modified: 28 Oct 2021 12:32
Reporter: Stephen Lin Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version: OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[19 Aug 2021 20:09] Stephen Lin
Description:
MySQL ODBC driver crashes in one of our test, The crash happens on all platforms.

The same test doesn't cause crash in the pervious version of driver.

Here is the back trace,
Exception thrown: read access violation.
str was nullptr.

    myodbc8w.dll!str_to_date(tagDATE_STRUCT * rgbValue, const char * str, unsigned int length, int zeroToMin) Line 2278 C++
    myodbc8w.dll!sql_get_data(STMT * stmt, short fCType, unsigned int column_number, void * rgbValue, __int64 cbValueMax, __int64 * pcbValue, char * value, unsigned long length, DESCREC * arrec) Line 705 C++
    myodbc8w.dll!fill_fetch_buffers(STMT * stmt, char * * values, unsigned int rownum) Line 1907    C++
    myodbc8w.dll!my_SQLExtendedFetch(void * hstmt, unsigned short fFetchType, __int64 irow, unsigned __int64 * pcrow, unsigned short * rgfRowStatus, bool upd_status) Line 2453 C++
    myodbc8w.dll!SQLFetch(void * StatementHandle) Line 2639 C++

How to repeat:
This happens in Tableau test, I have not found a way to reproduce this crash outside of the test. 

Here are some into,
Table: 
dateparse.dateparse_simple_years
Field	Type	Null	Key	Default	Extra
Column1	int(11)	NO		NULL	
Column2	int(11)	NO		NULL	

Column1,Column2
2003,1977
1983,1955
2016,2015
2020,2000
2050,1950

The Query caused the crash:
SELECT (CASE WHEN (NOT ISNULL(DATE(TIMESTAMP(STR_TO_DATE(CONCAT(CONCAT(`dateparse.dateparse_simple_years`.`Column1`), '-01-01'), '%Y-%m-%d'))))) THEN DATE(TIMESTAMP(STR_TO_DATE(CONCAT(CONCAT(`dateparse.dateparse_simple_years`.`Column1`), '-01-01'), '%Y-%m-%d'))) WHEN (NOT ISNULL(IFNULL(DATE(CONCAT(`dateparse.dateparse_simple_years`.`Column1`)),STR_TO_DATE(CONCAT(`dateparse.dateparse_simple_years`.`Column1`),'%b %e %Y')))) THEN IFNULL(DATE(CONCAT(`dateparse.dateparse_simple_years`.`Column1`)),STR_TO_DATE(CONCAT(`dateparse.dateparse_simple_years`.`Column1`),'%b %e %Y')) ELSE NULL END) AS `Column1`,
  `dateparse.dateparse_simple_years`.`Column2` AS `Column2`,
  1 AS `Number of Records`
FROM `dateparse.dateparse_simple_years`;
[19 Aug 2021 20:10] Stephen Lin
ODBC log

Attachment: mysql_8.0.26_odbc_trace.LOG (application/octet-stream, text), 429.54 KiB.

[28 Sep 2021 12:32] MySQL Verification Team
Hello Stephen Lin,

Thank you for the bug report.
Could you please provide a complete test project so that we can reproduce this issue at our end?

Regards,
Ashwini Patil
[29 Oct 2021 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".