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.
This commit is contained in:
Sujatha 2020-06-09 14:36:29 +05:30
parent 6e4e097bc2
commit 840fb495ce

View file

@ -350,16 +350,22 @@ Rpl_filter::set_do_table(const char* table_spec)
int status;
if (do_table_inited)
my_hash_reset(&do_table);
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
if (!do_table.records)
{
my_hash_free(&do_table);
do_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
if (do_table_inited && status)
{
if (!do_table.records)
{
my_hash_free(&do_table);
do_table_inited= 0;
}
}
return status;
}
@ -370,16 +376,22 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status;
if (ignore_table_inited)
my_hash_reset(&ignore_table);
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
if (!ignore_table.records)
{
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
if (ignore_table_inited && status)
{
if (!ignore_table.records)
{
my_hash_free(&ignore_table);
ignore_table_inited= 0;
}
}
return status;
}