Bug #56742 ResultSet getString Crash
Submitted: 13 Sep 2010 7:28 Modified: 23 Apr 2014 10:33
Reporter: ultimate tester Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S1 (Critical)
Version:1.0.5, 1.1.0 OS:Microsoft Windows
Assigned to: Lawrenty Novitsky CPU Architecture:Any
Tags: 15, char, characters, crash, get, res, ResultSet, string, varchar

[13 Sep 2010 7:28] ultimate tester
Description:
I have a few calls to the "getString" function of the ResultSet class.
Three of these calls will cause the application to crash individually (With this I mean that if I comment the other 2 calls out, the one left will still cause a crash).

This is caught by the Visual Studio debugger, gives an exception. The weird thing though, is that when I just click on "continue" the application continues, the getString call seems to be successfull because the string got copied from database to my string. Although, when I run the application without the debugger, windows gives the message the application has stopped functioning.

Also, the weird thing about these 3 calls to "getString" is that they all 3 are returning a string longer than 15 characters. The other calls to getString are not.
Whenever I make the VARCHAR in the database longer than 15 chars (not the max value which I set to 200 but the actual string it should return) then this will cause a crash aswell.

Maybe another detail is that I'm making a MFC application (release mode).

How to repeat:
In the database:

VARCHAR with a value longer than 15 characters.

In the project:

MFC application in release mode, linked like the documentation explains (dynamically) and simply call getString to this table (VARCHAR) which value is longer than 15 characters.

Suggested fix:
I don't know. Seems like a bug in the library...
[13 Sep 2010 15:55] Sveta Smirnova
Thank you for the report.

This looks similar to bug #53682. But I could not repeat the problem. Please answer questions from comment "[11 Jun 11:58] Sveta Smirnova" in bug #53682 and if you can not repeat the problem with test provided send us repeatable test case.
[14 Sep 2010 6:43] ultimate tester
Visual Studio 2005 in Release mode.
I debug the application with the visual studio debugger (the green arrow), and if I just run the application without any debugger, it just crashes.

I think I don't have to give any source code, since it's a very simple line. I made a class to manage the database and on the part I call res->getString it gives an exception.

I connect to a remote database.

In your post, I see an example of a console application.. 
I have a MFC application I think that matters.

Of course I searched on google for my problem, and found that it had something to do with the Runtime Library which is set to /MD.

For MFC application this has to be /MD otherwise it won't compile. I think the mysql connector needs /MT.
[14 Sep 2010 12:18] MySQL Verification Team
If you can provide a solution file test case would be nice. Thanks in advance.
[14 Sep 2010 13:46] ultimate tester
No problem. I uploaded a testenvironment to here:

http://www.mueters.net/TestEnvironment.rar

What you need to change before it will work:

- The linker options (where the mysql headers and libraries are)
- The database details

You also need to run the database query I included with the package (testenvironment.sql) which will create a table called "testenvironment" and make 2 varchars (filled with 1 string of 14 chars, other string of 17 chars) 

You will see that the string of 17 chars will crash.
[22 Sep 2010 9:14] Ulf Wendel
Please try Connector/C++ 1.1.0, which is the current version. Thanks!
[22 Sep 2010 10:04] ultimate tester
Just tried the latest version. This one has the same problem slightly different:

exactly 15 or less is okay now, higher than 15 is not.
earlier, exactly 15 or higher would crash.

Also, I had to find the BOOST libraries myself, and the installer does have different files compared to the no-installer zip.
[24 Nov 2010 14:30] Ulf Wendel
Please do not link to downloads but post the settings you use to the bug system. I cannot reach your server at the moment.

Please confirm that you have followed all hints that are given at http://forge.mysql.com/wiki/Connector_C%2B%2B under "CAUTION: binary compatibility on Windows" including the notes from the http://forge.mysql.com/wiki/Connector_C%2B%2B_Binary_Builds . Basically you must ensure that you use the following are identical for C/C++ library and your C++ client application:

 - CRT versions must match
 - CRT related compiler flags must match
 - compiler versions must match

Which settings we use is documented on the wiki pages. 

Ulf
[25 Dec 2010 0: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".
[26 Jan 2011 7:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/129608

2926 Georg Richter	2011-01-26
      Fixed copyright header (bug #56742)
[23 Apr 2014 10:32] Bogdan Degtyariov
Posted by developer:
 
Fixed in 1.1.1