Bug #69550 | MS Access crashed when sorting a column | ||
---|---|---|---|
Submitted: | 22 Jun 2013 12:23 | Modified: | 5 Feb 2014 21:11 |
Reporter: | Carlos Herr | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / ODBC | Severity: | S2 (Serious) |
Version: | 5.2.5 | OS: | Windows (XP SP3 / Server 2003) |
Assigned to: | Bogdan Degtyariov | CPU Architecture: | Any |
Tags: | underscore link crash access |
[22 Jun 2013 12:23]
Carlos Herr
[22 Jun 2013 12:28]
Carlos Herr
With Windows 7 there is no problem. Thanks.
[22 Jun 2013 15:45]
Carlos Herr
S2
[24 Jun 2013 9:10]
Bogdan Degtyariov
Hi Carlos, Thank you for you interest in MySQL software and for reporting the issue in MySQL Connector/ODBC driver. Can you please indicate which version of MS Access you are using? Also, if I understand the problem correctly the crash occurs upon a specific data set, not just any table with any data. Is that right? If yes, I would like to check the CREATE TABLE statement and a few records as INSERT to repeat the problem. For a big table you can use mysqldump.exe command line utility to dump the table structure along with the table contents. Thanks.
[24 Jun 2013 11:24]
Carlos Herr
dump
Attachment: datosio4bid.sql (application/octet-stream, text), 2.93 KiB.
[24 Jun 2013 11:29]
Carlos Herr
The problem occurs with Office 2007 and Office 2010 with all the updates and patches applied, in systenms with Server 2003 (Terminal Server) and XP SP3. In Windows 7 there is no problem. Yoy can repeat the problem by repeatedly sort on any column key. With this data (only 3-4 rows) sometimes 30-40 times to crash. Thanks.
[24 Jun 2013 12:51]
MySQL Verification Team
I couldn't repeat on Windows 8 64-bits.
[24 Jun 2013 13:21]
Bogdan Degtyariov
Carlos, Thank you for sending the sample data. I was able to repeat the crash in MS Access 2007. Setting the bug status to Verified.
[25 Jun 2013 6:27]
Bogdan Degtyariov
Hi Carlos, I have found the reason why the ODBC Driver crashes MS Access. It also explains why the problem is not repeatable in the newer versions of Windows. MS Access is working with Unicode strings, but you used the ANSI (non-Unicode) version of Connector/ODBC driver (myodbc5a.dll corresponds to the ANSI version). Hence, in order to process all string data the Windows driver manager is performing the Uicode <--> ANSI data conversion each time string values are being read or written. Sometimes this conversion does not go right and the driver gets the corrupted string, which crashes the strlen() function. The data that comes from the client (MS Access) to the driver is completely unreadable, so it must be the Unicode->ANSI conversion issue. Apparently in the newer versions of Windows the conversion errors got fixed and therefore even the ANSI version driver did not crash. Using the Unicode version (myodbc5w.dll) resolves the problem because the driver manager does not need to convert anything. I changed the sorting order at least 100 times and no crash happened. With the ANSI version it was enough to repeat sorting 10-15 times (30-40 at max as you said). Please try the Unicode version of Connector/ODBC and let me know the result. Thanks.
[25 Jun 2013 10:20]
Carlos Herr
Sorry, but the error is repeating with both ANSI and NON-ANSI. Really, before that, I tried Unicode version of Connector/ODBC too. Thanks.
[26 Jun 2013 8:29]
Bogdan Degtyariov
Carlos, I spent lots of time clicking (300 clicks) on the sorting options in MS Access 2007 without any effect. Then I restarted MS Access and repeated 300 clicks again. ANSI driver would crash on that for sure. Do you have any additional options in the DSN for the UNICODE driver? For instance, the sorting in Access might become unstable with the option [Details->Misc->Prepare Statements on client] used for applications that require preparing statements on the client side.
[27 Jun 2013 12:00]
Carlos Herr
I can't understand. The error is repeating with Unicode driver, and without any additional options. Faulting application msaccess.exe, version 12.0.4518.1014, stamp 4542815c, faulting module myodbc5w.dll, version 5.2.5.0, stamp 515d8854, debug? 0, fault address 0x000171f3. Thanks.
[27 Jun 2013 12:48]
Bogdan Degtyariov
I was able to repeat the crash with the Unicode version, but it only happens when the sort order is changed quickly before the previous sort result is displayed.
[9 Jul 2013 8:49]
Bogdan Degtyariov
Here is the troubling piece of code: results.c (1185-1191): irrec= desc_get_rec(stmt->ird, ColumnNumber, FALSE); assert(irrec); /* catalog functions with "fake" results won't have lengths */ length= irrec->row.datalen; if (!length && stmt->current_values[ColumnNumber]) length= strlen(stmt->current_values[ColumnNumber]); <-- crash! The code above is very very wrong. Imagine the situation when the column value in the database is NULL, so the contents of stmt->current_values[ColumnNumber] is garbage. We cannot do strlen() to it. In this case we should use the length, which is 0. For the catalog functions fake results should be detected by using the special flag stmt->fake_result: irrec= desc_get_rec(stmt->ird, ColumnNumber, FALSE); assert(irrec); /* catalog functions with "fake" results won't have lengths */ length= irrec->row.datalen; if (stmt->fake_result && !length && stmt->current_values[ColumnNumber]) { length= strlen(stmt->current_values[ColumnNumber]); }
[9 Jul 2013 11:37]
Bogdan Degtyariov
Patch, without the test case (not possible to have a reliable test case)
Attachment: bug69550.diff (application/octet-stream, text), 985 bytes.
[9 Jul 2013 12:08]
Lawrenty Novitsky
i will try to play with a testcase 8-)
[22 Jan 2014 10:57]
Bogdan Degtyariov
Pushed in the Connector/ODBC source repository.
[5 Feb 2014 21:11]
Daniel So
Added the following changelog entry into the Connector/ODBC 5.2.7 and 5.3.2 changelogs: "When using Connector/ODBC in Microsoft Access, sorting a column in the data view might crash the program."