summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-06-09 14:36:29 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-06-10 14:44:27 +0530
commit840fb495ce2c0c00b20f2a9ba44b6fcc20c56118 (patch)
tree2bb283450976288f95b5888fd22dc7dd435458e1
parent6e4e097bc26d33951fedf8399f552ae4a336451e (diff)
downloadmariadb-git-840fb495ce2c0c00b20f2a9ba44b6fcc20c56118.tar.gz
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.
-rw-r--r--sql/rpl_filter.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc
index 24b76cf7c42..5c4a4d9f58a 100644
--- a/sql/rpl_filter.cc
+++ b/sql/rpl_filter.cc
@@ -350,14 +350,20 @@ Rpl_filter::set_do_table(const char* table_spec)
int status;
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);
- if (!do_table.records)
+ if (do_table_inited && status)
{
- my_hash_free(&do_table);
- do_table_inited= 0;
+ if (!do_table.records)
+ {
+ my_hash_free(&do_table);
+ do_table_inited= 0;
+ }
}
return status;
@@ -370,14 +376,20 @@ Rpl_filter::set_ignore_table(const char* table_spec)
int status;
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);
- if (!ignore_table.records)
+ if (ignore_table_inited && status)
{
- my_hash_free(&ignore_table);
- ignore_table_inited= 0;
+ if (!ignore_table.records)
+ {
+ my_hash_free(&ignore_table);
+ ignore_table_inited= 0;
+ }
}
return status;