Skip to content
Permalink
Browse files
MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / sta…
…tistics_for_tables_is_needed

Backport the fix f214d36 to 10.0

   Author: Sergei Golubchik <serg@mariadb.org>
   Date:   Tue Apr 17 00:44:34 2018 +0200

    ASAN error in is_stat_table()

    don't memcmp beyond the first argument's end

    Also: use my_strcasecmp(table_alias_charset), like elsewhere, not memcmp
  • Loading branch information
varunraiko committed Jul 11, 2018
1 parent a2c0376 commit ad9d1e8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
@@ -516,4 +516,11 @@ use test;
drop database db1;
drop database db2;
drop table t1;
#
# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
#
SET use_stat_tables = PREFERABLY;
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' )
NULL
set use_stat_tables=@save_use_stat_tables;
@@ -543,6 +543,13 @@ use test;
drop database db1;
drop database db2;
drop table t1;
#
# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
#
SET use_stat_tables = PREFERABLY;
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' )
NULL
set use_stat_tables=@save_use_stat_tables;
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
@@ -305,4 +305,10 @@ drop database db1;
drop database db2;
drop table t1;

--echo #
--echo # MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
--echo #

SET use_stat_tables = PREFERABLY;
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
set use_stat_tables=@save_use_stat_tables;
@@ -3858,11 +3858,11 @@ bool is_stat_table(const char *db, const char *table)
{
DBUG_ASSERT(db && table);

if (!memcmp(db, stat_tables_db_name.str, stat_tables_db_name.length))
if (!my_strcasecmp(table_alias_charset, db, stat_tables_db_name.str))
{
for (uint i= 0; i < STATISTICS_TABLES; i ++)
{
if (!memcmp(table, stat_table_name[i].str, stat_table_name[i].length))
if (!my_strcasecmp(table_alias_charset, table, stat_table_name[i].str))
return true;
}
}

0 comments on commit ad9d1e8

Please sign in to comment.