Skip to content

Commit 800eee4

Browse files
sujatha-svaintroub
authored andcommitted
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.
1 parent dc06873 commit 800eee4

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

sql/rpl_filter.cc

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,20 @@ Rpl_filter::set_do_table(const char* table_spec)
350350
int status;
351351

352352
if (do_table_inited)
353-
my_hash_reset(&do_table);
353+
{
354+
my_hash_free(&do_table);
355+
do_table_inited= 0;
356+
}
354357

355358
status= parse_filter_rule(table_spec, &Rpl_filter::add_do_table);
356359

357-
if (!do_table.records)
360+
if (do_table_inited && status)
358361
{
359-
my_hash_free(&do_table);
360-
do_table_inited= 0;
362+
if (!do_table.records)
363+
{
364+
my_hash_free(&do_table);
365+
do_table_inited= 0;
366+
}
361367
}
362368

363369
return status;
@@ -370,14 +376,20 @@ Rpl_filter::set_ignore_table(const char* table_spec)
370376
int status;
371377

372378
if (ignore_table_inited)
373-
my_hash_reset(&ignore_table);
379+
{
380+
my_hash_free(&ignore_table);
381+
ignore_table_inited= 0;
382+
}
374383

375384
status= parse_filter_rule(table_spec, &Rpl_filter::add_ignore_table);
376385

377-
if (!ignore_table.records)
386+
if (ignore_table_inited && status)
378387
{
379-
my_hash_free(&ignore_table);
380-
ignore_table_inited= 0;
388+
if (!ignore_table.records)
389+
{
390+
my_hash_free(&ignore_table);
391+
ignore_table_inited= 0;
392+
}
381393
}
382394

383395
return status;

0 commit comments

Comments
 (0)