Bug #64754 segfault using prepared select statement
Submitted: 24 Mar 2012 12:13 Modified: 25 Mar 2012 8:56
Reporter: Richard Kojedzinszky Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:5.1.61 OS:Linux (debian wheezy)
Assigned to: CPU Architecture:Any

[24 Mar 2012 12:13] Richard Kojedzinszky
I was using tntdb as a wrapper around mysql, but when a prepared select statement was
executed multiple times, the application crashed. The crash came from libmysql. Attached
a c app which does nearly the same calls as tntdb does.

How to repeat:
Will attach a simple file which shows the case.

If for some reason it does not segfault, the run it with valgrind -v, it'll show the invalid memory access.

Suggested fix:
Somehow it would be nice to inform the MYSQL_STMT structure that a MYSQL_BIND has
[24 Mar 2012 12:14] Richard Kojedzinszky
C program to show the bug

Attachment: test.c (text/x-csrc), 2.49 KiB.

[24 Mar 2012 12:14] Richard Kojedzinszky
C++ program using tntdb to reproduce the bug

Attachment: test.cpp (text/x-c++src), 309 bytes.

[24 Mar 2012 12:43] Valeriy Kravchuk
Is it a duplicate of bug #64725 you had reported some time ago?
[24 Mar 2012 20:39] Richard Kojedzinszky
Yes, sorry, I just did not know if I've filed it under the right category, and no response was received.
[25 Mar 2012 8:56] Valeriy Kravchuk
This is a duplicate of bug #64725.