Commit 800eee42 authored by Sujatha's avatar Sujatha Committed by Vladislav Vaintroub

MDEV-22059: MSAN report at replicate_ignore_table_grant

Analysis:
========
List of values provided for "replicate_ignore_table" and "replicate_do_table"
are stored in HASH.  When an empty list is provided the HASH structure doesn't
get initialized. Existing code treats empty element list as an error and tries
to clean the uninitialized HASH. This results in above MSAN issue.

Fix:
===
The clean up should be initiated only when there is an error while parsing the
'replicate_do_table' or 'replicate_ignore_table' list and the HASH is in
initialized state. Otherwise for empty list it should simply return success.
parent dc068734
...@@ -350,14 +350,20 @@ Rpl_filter::set_do_table(const char* table_spec) ...@@ -350,14 +350,20 @@ Rpl_filter::set_do_table(const char* table_spec)
int status; int status;
if (do_table_inited) if (do_table_inited)
my_hash_reset(&do_table); {
my_hash_free(&do_table);
do_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table); status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
if (!do_table.records) if (do_table_inited && status)
{ {
my_hash_free(&do_table); if (!do_table.records)
do_table_inited= 0; {
my_hash_free(&do_table);
do_table_inited= 0;
}
} }
return status; return status;
...@@ -370,14 +376,20 @@ Rpl_filter::set_ignore_table(const char* table_spec) ...@@ -370,14 +376,20 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status; int status;
if (ignore_table_inited) if (ignore_table_inited)
my_hash_reset(&ignore_table); {
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table); status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
if (!ignore_table.records) if (ignore_table_inited && status)
{ {
my_hash_free(&ignore_table); if (!ignore_table.records)
ignore_table_inited= 0; {
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
} }
return status; return status;
......
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