#At file:///home/alik/MySQL/bzr/00/bug56115/mysql-5.5-bug56115/ based on revid:anitha.gopi@stripped
3367 Alexander Nozdrin 2011-03-03
A patch for Bug#11763413 (invalid memory reads when PS selecting
from information_schema tables).
The problem was in some corner cases TABLE instance might have
NULL 's' attribute (a pointer to TABLE_SHARE).
The fix is to check if TABLE::s is not NULL.
modified:
mysql-test/r/ps.result
mysql-test/t/ps.test
sql/field.cc
=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result 2010-11-13 15:05:02 +0000
+++ b/mysql-test/r/ps.result 2011-03-03 07:51:42 +0000
@@ -3731,5 +3731,17 @@ CREATE TABLE t1 (a INT);
BEGIN;
PREPARE stmt1 FROM "SELECT * FROM t1";
DROP TABLE t1;
+
#
-# End of 6.0 tests.
+# Bug#56115: invalid memory reads when PS selecting from
+# information_schema tables
+# Bug#58701: crash in Field::make_field, cursor-protocol
+#
+
+SELECT *
+FROM (SELECT 1 UNION SELECT 2) t;
+1
+1
+2
+#
+# End of 5.5 tests.
=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test 2010-11-13 15:05:02 +0000
+++ b/mysql-test/t/ps.test 2011-03-03 07:51:42 +0000
@@ -3344,7 +3344,19 @@ connection default;
DROP TABLE t1;
disconnect con1;
+--echo
--echo #
---echo # End of 6.0 tests.
+--echo # Bug#56115: invalid memory reads when PS selecting from
+--echo # information_schema tables
+--echo # Bug#58701: crash in Field::make_field, cursor-protocol
+--echo #
+--echo
+
+SELECT *
+FROM (SELECT 1 UNION SELECT 2) t;
+
+
+--echo #
+--echo # End of 5.5 tests.
###########################################################################
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-02-08 15:47:33 +0000
+++ b/sql/field.cc 2011-03-03 07:51:42 +0000
@@ -1552,7 +1552,8 @@ void Field_num::add_zerofill_and_unsigne
void Field::make_field(Send_field *field)
{
- if (orig_table && orig_table->s->db.str && *orig_table->s->db.str)
+ if (orig_table && orig_table->s &&
+ orig_table->s->db.str && *orig_table->s->db.str)
{
field->db_name= orig_table->s->db.str;
if (orig_table->pos_in_table_list &&
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110303075142-rlm6hankbh4nzs65.bundle