summaryrefslogtreecommitdiff
path: root/mysql-test/t/func_like.test
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2010-06-20 02:02:58 +0400
committerRamil Kalimullin <ramil@mysql.com>2010-06-20 02:02:58 +0400
commit1614c3c1288ad9d71879d44ef4e8c1edee84d96a (patch)
treebea28b1d459f6974daa97c2f35a992a64afdb346 /mysql-test/t/func_like.test
parent5088fb1394a51003038efc6fb901461ad880255a (diff)
downloadmariadb-git-1614c3c1288ad9d71879d44ef4e8c1edee84d96a.tar.gz
Fix for bug #54575: crash when joining tables with unique set column
Problem: a flaw (derefencing a NULL pointer) in the LIKE optimization code may lead to a server crash in some rare cases. Fix: check the pointer before its dereferencing. mysql-test/r/func_like.result: Fix for bug #54575: crash when joining tables with unique set column - test result. mysql-test/t/func_like.test: Fix for bug #54575: crash when joining tables with unique set column - test case. sql/item_cmpfunc.cc: Fix for bug #54575: crash when joining tables with unique set column - check res2 buffer pointer before its dereferencing as it may be NULL in some cases.
Diffstat (limited to 'mysql-test/t/func_like.test')
-rw-r--r--mysql-test/t/func_like.test18
1 files changed, 16 insertions, 2 deletions
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 741ea5533da..1204d04d9a0 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -112,5 +112,19 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
#
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
-#
-# End of 4.1 tests
+
+--echo End of 4.1 tests
+
+
+--echo #
+--echo # Bug #54575: crash when joining tables with unique set column
+--echo #
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+DROP TABLE t1, t2;
+
+
+--echo End of 5.1 tests