diff options
author | unknown <igor@olga.mysql.com> | 2007-03-31 00:23:03 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-03-31 00:23:03 -0700 |
commit | 7887a74491051d67fe0d780e19a62b5f055d07f9 (patch) | |
tree | 30965172fb391f49ca43b269726d625266437a20 /mysql-test | |
parent | 8aa507edb99a6f24553b9a8f773411327307aa0b (diff) | |
download | mariadb-git-7887a74491051d67fe0d780e19a62b5f055d07f9.tar.gz |
Fixed bug #27154: memory corruption when using row equalities in where
conditions.
When allocating memory for KEY_FIELD/SARGABLE_PARAM structures the
function update_ref_and_keys did not take into account the fact that
a single row equality could be replaced by several simple equalities.
Fixed by adjusting the counter cond_count accordingly for each subquery
when performing substitution of a row equality for simple equalities.
mysql-test/r/row.result:
Added a test case for bug #27154.
mysql-test/t/row.test:
Added a test case for bug #27154.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/row.result | 13 | ||||
-rw-r--r-- | mysql-test/t/row.test | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 5b5f8b7b954..faf9b11d7c9 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -306,3 +306,16 @@ a b a b c 1 1 1 2 1 1 2 1 2 1 DROP TABLE t1,t2; +CREATE TABLE t1( +a int, b int, c int, d int, e int, f int, g int, h int, +PRIMARY KEY (a,b,c,d,e,f,g) +); +INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99); +SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7); +h +99 +SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7)); +SELECT @x; +@x +99 +DROP TABLE t1; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 63c611e6be6..1d5c7a543ea 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -139,3 +139,20 @@ EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1); DROP TABLE t1,t2; + +# +# Bug #27154: crash (memory corruption) when using row equalities +# + +CREATE TABLE t1( + a int, b int, c int, d int, e int, f int, g int, h int, + PRIMARY KEY (a,b,c,d,e,f,g) +); +INSERT INTO t1 VALUES (1,2,3,4,5,6,7,99); + +SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7); + +SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7)); +SELECT @x; + +DROP TABLE t1; |