Commit 8bf17c57 authored by Monty's avatar Monty

MDEV-32388 MSAN / Valgrind errors in Item_func_like::get_mm_leaf upon query from partitioned table

The problem was that RANGE_OPT_PARAM was not completely initialized in
some cases.
Added bzero() to ensure that all elements are always initialized.
parent 55534a26
......@@ -2858,3 +2858,16 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key
set optimizer_switch=@tmp_os;
drop table t1,t2,t3;
#
# MDEV-32388 MSAN / Valgrind errors in
# Item_func_like::get_mm_leaf upon query from partitioned table
#
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 WHERE a LIKE '1';
a
1
DROP TABLE t1;
#
# End of 10.6 tests
#
......@@ -3066,3 +3066,17 @@ set optimizer_switch=@tmp_os;
drop table t1,t2,t3;
--echo #
--echo # MDEV-32388 MSAN / Valgrind errors in
--echo # Item_func_like::get_mm_leaf upon query from partitioned table
--echo #
CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2;
INSERT INTO t1 VALUES (1),(2);
SELECT * FROM t1 WHERE a LIKE '1';
DROP TABLE t1;
--echo #
--echo # End of 10.6 tests
--echo #
......@@ -2757,6 +2757,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
DBUG_RETURN(0); // Fatal error flag is set
/* set up parameter that is passed to all functions */
bzero((void*) &param, sizeof(param));
param.thd= thd;
param.baseflag= head->file->ha_table_flags();
param.prev_tables=prev_tables | const_tables;
......@@ -3949,6 +3950,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
prune_param.part_info= part_info;
init_sql_alloc(key_memory_quick_range_select_root, &alloc,
thd->variables.range_alloc_block_size, 0, MYF(MY_THREAD_SPECIFIC));
bzero((void*) range_par, sizeof(*range_par));
range_par->mem_root= &alloc;
range_par->old_root= thd->mem_root;
......@@ -3974,6 +3976,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
range_par->remove_jump_scans= FALSE;
range_par->real_keynr[0]= 0;
range_par->alloced_sel_args= 0;
range_par->note_unusable_keys= 0;
thd->no_errors=1; // Don't warn about NULL
thd->mem_root=&alloc;
......
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