diff options
author | Nayuta Yanagisawa <nayuta.yanagisawa@hey.com> | 2021-03-05 17:51:17 +0000 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-03-08 21:24:38 +0100 |
commit | 75f781f0d27d73dce4c7570e5b94b9482903c907 (patch) | |
tree | b1ad8eaa88d309c95b45e801eb82b94f943d066e /sql/sql_show.cc | |
parent | ecc1cd219d427e62acbd37c4c02e1f99d6c2d769 (diff) | |
download | mariadb-git-75f781f0d27d73dce4c7570e5b94b9482903c907.tar.gz |
MDEV-24868 Server crashes in optimize_schema_tables_memory_usage after select from information_schema.innodb_sys_columns
optimize_schema_tables_memory_usage() crashed when its argument included
TABLE struct that was not fully initialized.
To prevent such a crash, we check if a table is an information schema table at
the beginning of each iteration.
Closes #1768
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e6b5461e5af..469f28acf6c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8672,14 +8672,19 @@ end: bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) { + DBUG_ENTER("optimize_schema_tables_memory_usage"); + List_iterator<TABLE_LIST> tli(tables); while (TABLE_LIST *table_list= tli++) { + if (!table_list->schema_table) + continue; + TABLE *table= table_list->table; THD *thd=table->in_use; - if (!table_list->schema_table || !thd->fill_information_schema_tables()) + if (!thd->fill_information_schema_tables()) continue; if (!table->is_created()) @@ -8726,10 +8731,10 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) // TODO switch from Aria to Memory if all blobs were optimized away? if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo, table_list->select_lex->options | thd->variables.option_bits)) - return 1; + DBUG_RETURN(1); } } - return 0; + DBUG_RETURN(0); } |