summaryrefslogtreecommitdiff
path: root/mysql-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
commit9b07b12b3d335f77b0916e16d4f13cdab4f6eada (patch)
treebea28b1d459f6974daa97c2f35a992a64afdb346 /mysql-test
parent936a2b111ad375d4affc7b89ed1d9fe7570bcaf5 (diff)
downloadmariadb-git-9b07b12b3d335f77b0916e16d4f13cdab4f6eada.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.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_like.result14
-rw-r--r--mysql-test/t/func_like.test18
2 files changed, 30 insertions, 2 deletions
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 9338a76e320..21da211160b 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -169,3 +169,17 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
_cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'
1
+End of 4.1 tests
+#
+# Bug #54575: crash when joining tables with unique set column
+#
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+1
+DROP TABLE t1, t2;
+End of 5.1 tests
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