#At file:///home/nirbhay/Project/mysql/repo/bugs/source/mysql-5.1-59109/ based on revid:alexander.nozdrin@stripped
3531 Nirbhay Choubey 2011-01-07
Bug#59109 : mysqlslap crashes on mysql_fetch_row after ignoring
null from mysql_store_result.
mysqlslap segfaults at a point when it tries to fetch rows from
the result set.
Under some circumstances, mysql_store_result can return 'NULL',
even after query execution (mysql_query) succeeds, and eventually
a segfault might occur if same unchecked return value is passed
to mysql_fetch_row.
Fixed by adding a check on mysql_store_result's return value.
@ client/mysqlslap.c
Bug#59109 : mysqlslap crashes on mysql_fetch_row after ignoring
null from mysql_store_result.
Added a check on mysql_store_result's return value. A 'NULL' return
value here shows an erroneous situation as mysql_field_count has already
reported a non-zero value.
modified:
client/mysqlslap.c
=== modified file 'client/mysqlslap.c'
--- a/client/mysqlslap.c 2010-06-10 20:16:43 +0000
+++ b/client/mysqlslap.c 2011-01-07 09:40:04 +0000
@@ -1891,10 +1891,15 @@ limit_not_met:
{
if (mysql_field_count(mysql))
{
- result= mysql_store_result(mysql);
- while ((row = mysql_fetch_row(result)))
- counter++;
- mysql_free_result(result);
+ if (!(result= mysql_store_result(mysql)))
+ fprintf(stderr,"%s: Error when storing result: %d %s\n",
+ my_progname, mysql_errno(mysql), mysql_error(mysql));
+ else
+ {
+ while ((row = mysql_fetch_row(result)))
+ counter++;
+ mysql_free_result(result);
+ }
}
} while(mysql_next_result(mysql) == 0);
queries++;
Attachment: [text/bzr-bundle]
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (nirbhay.choubey:3531) Bug#59109 | Nirbhay Choubey | 7 Jan |