| Bug #68230 | Crash after getting value by filedname from MYSQL_FIELD(mysql_fetch_fields) | ||
|---|---|---|---|
| Submitted: | 31 Jan 2013 4:04 | Modified: | 12 Mar 2013 18:31 |
| Reporter: | tinacy tong | Email Updates: | |
| Status: | No Feedback | Impact on me: | |
| Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
| Version: | 5.5.29 | OS: | Linux (CentOS release 5.5) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | filed, mysql_fetch_fields, MYSQL_FIELD | ||
[31 Jan 2013 4:07]
tinacy tong
simple test code
Attachment: mysql_bug.cpp (text/plain), 3.68 KiB.
[2 Feb 2013 11:52]
MySQL Verification Team
Compiled like this: g++ ./bug68230.cpp -o bug68230 `mysql_config --libs_r` `mysql_config --include` Seems to work for me against a 5.5.29 server, using 5.5.29 client libs: [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 success [sbester@fc17 ~]$ ./bug68230 Did I do something different to you?
[13 Mar 2013 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".

Description: part of c++ source code: MYSQL_FIELD *fields; MYSQL_RES *m_result map<string, int> m_FieldIndex; fields = mysql_fetch_fields(m_result); for(i = 0; i < m_iField; i++) { m_FieldIndex[fields[i].name] = i; } During the loop(normally i>=2 ), there will throw a crash becase the address of fields[i] reference to 0x00. but if you do "p mysql_fetch_fields(m_resut)[i]" under gdb, it work well. It seems the param value of "fields" changed after returned from the function mysql_fetch_fields. This is my first bug in english. Please forgive my bad expression. How to repeat: 1、source install mysql5.5.29 under CentOs release 5.5 2、Compile the source file mysql_bug.cpp 3、./mysql_bug run th programe and see the result result: Output "error basic_string::_S_construct NULL not valid" note: This exception was throw in line 130.