#At file:///home/gluh/MySQL/mysql-5.1-bug-37284/ based on revid:chad@stripped
2716 Sergey Glukhov 2008-11-19
Bug#37284 Crash in Field_string::type()
The bug is repeatable with latest(1.0.1) InnoDB plugin on Linux, Win,
If MySQL is compiled with valgrind there are errors about
using of uninitialized variable(orig_table).
The fix is to set field->orig_table correct value.
modified:
mysql-test/r/innodb_mysql.result
mysql-test/t/innodb_mysql.test
sql/sql_base.cc
per-file messages:
mysql-test/r/innodb_mysql.result
test result
mysql-test/t/innodb_mysql.test
test case
sql/sql_base.cc
set field->orig_table to 'table' value because it may be bogus and
it leads to crash on Field_string::type() function.
=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result 2008-11-03 17:46:47 +0000
+++ b/mysql-test/r/innodb_mysql.result 2008-11-19 13:41:13 +0000
@@ -1677,3 +1677,9 @@ select @@session.sql_log_bin, @@session.
CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+a
+DROP TABLE t1;
=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test 2008-11-03 17:46:47 +0000
+++ b/mysql-test/t/innodb_mysql.test 2008-11-19 13:41:13 +0000
@@ -43,3 +43,13 @@ CREATE TABLE t1 ( a INT ) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
+#
+# Bug#37284 Crash in Field_string::type()
+#
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
+CREATE INDEX i1 on t1 (a(3));
+SELECT * FROM t1 WHERE a = 'abcde';
+DROP TABLE t1;
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2008-11-03 10:40:58 +0000
+++ b/sql/sql_base.cc 2008-11-19 13:41:13 +0000
@@ -3095,7 +3095,10 @@ bool reopen_table(TABLE *table)
for (key=0 ; key < table->s->keys ; key++)
{
for (part=0 ; part < table->key_info[key].usable_key_parts ; part++)
+ {
table->key_info[key].key_part[part].field->table= table;
+ table->key_info[key].key_part[part].field->orig_table= table;
+ }
}
if (table->triggers)
table->triggers->set_table(table);
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (Sergey.Glukhov:2716) Bug#37284 | Sergey Glukhov | 19 Nov |