summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-06-28 18:38:55 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-06-28 18:38:55 +0300
commit107c894a540d147338ab4e737eb9ef76e49c3493 (patch)
treeac775c6049caad12351f943d51ed977413345b5c /client
parent1ede2dd8146254951493081f2297b0832fdd4d13 (diff)
downloadmariadb-git-107c894a540d147338ab4e737eb9ef76e49c3493.tar.gz
Bug #13708485: malformed resultset packet crashes client
Several fixes : * sql-common/client.c Added a validity check of the fields metadata packet sent by the server. Now libmysql will check if the length of the data sent by the server matches what's expected by the protocol before using the data. * client/mysqltest.cc Fixed the error handling code in mysqltest to avoid sending new commands when the reading the result set failed (and there are unread data in the pipe). * sql_common.h + libmysql/libmysql.c + sql-common/client.c unpack_fields() now generates a proper error when it fails. Added a new argument to this function to support the error generation. * sql/protocol.cc Added a debug trigger to cause the server to send a NULL insted of the packet expected by the client for testing purposes.
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 593bb8ea290..e595493ccf0 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -6848,6 +6848,8 @@ void run_query_normal(struct st_connection *cn, struct st_command *command,
*/
if ((counter==0) && mysql_read_query_result(mysql))
{
+ /* we've failed to collect the result set */
+ cn->pending= TRUE;
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), ds);
goto end;