Commit df4f4bd8 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN

Fix a trivial error in the fix for MDEV-21958: check the key in the right
table.
parent dfe8ef8b
...@@ -3174,5 +3174,15 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -3174,5 +3174,15 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where 1 SIMPLE t2 ALL PRIMARY NULL NULL NULL 1000 Using where
drop table t1,t2; drop table t1,t2;
# #
# MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN
#
CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a));
INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20);
CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code));
INSERT INTO t2 VALUES ('100',1),('111',2);
SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3;
id a b code num
DROP TABLE t1, t2;
#
# End of 10.2 tests # End of 10.2 tests
# #
...@@ -2204,6 +2204,19 @@ explain select * from t2 force index (primary) where pk not in (1,2,3); ...@@ -2204,6 +2204,19 @@ explain select * from t2 force index (primary) where pk not in (1,2,3);
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-24444: ASAN use-after-poison in Item_func_in::get_func_mm_tree with NOT IN
--echo #
CREATE TABLE t1 (id INT, a CHAR(3), b INT, PRIMARY KEY(id), KEY(b), KEY(a));
INSERT INTO t1 VALUES (1,'foo',10),(2,'bar',20);
CREATE TABLE t2 (code CHAR(8), num INT, PRIMARY KEY (code));
INSERT INTO t2 VALUES ('100',1),('111',2);
SELECT * FROM t1 JOIN t2 ON (t2.code = t1.b) WHERE t1.a NOT IN ('baz', 'qux') OR t2.num != 3;
DROP TABLE t1, t2;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
......
...@@ -7173,7 +7173,7 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param, ...@@ -7173,7 +7173,7 @@ SEL_TREE *Item_func_in::get_func_mm_tree(RANGE_OPT_PARAM *param,
uint key_no; uint key_no;
while ((key_no= it.next_bit()) != key_map::Iterator::BITMAP_END) while ((key_no= it.next_bit()) != key_map::Iterator::BITMAP_END)
{ {
KEY *key_info= &param->table->key_info[key_no]; KEY *key_info= &field->table->key_info[key_no];
if (key_info->user_defined_key_parts == 1 && if (key_info->user_defined_key_parts == 1 &&
(key_info->flags & HA_NOSAME)) (key_info->flags & HA_NOSAME))
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment