mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-19536 - Server crash or ASAN heap-use-after-free in is_temporary_table /
read_statistics_for_tables_if_needed
Regression after 279a907
, read_statistics_for_tables_if_needed() was
called after open_normal_and_derived_tables() failure.
Fixed by moving read_statistics_for_tables() call to a branch of
get_schema_stat_record() where result of open_normal_and_derived_tables()
is checked.
Removed THD::force_read_stats, added read_statistics_for_tables() instead.
Simplified away statistics_for_command_is_needed().
This commit is contained in:
@ -4272,7 +4272,6 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
|
||||
SQLCOM_SHOW_FIELDS is used because it satisfies
|
||||
'only_view_structure()'.
|
||||
*/
|
||||
thd->force_read_stats= get_schema_table_idx(schema_table) == SCH_STATISTICS;
|
||||
lex->sql_command= SQLCOM_SHOW_FIELDS;
|
||||
result= (open_temporary_tables(thd, table_list) ||
|
||||
open_normal_and_derived_tables(thd, table_list,
|
||||
@ -4287,9 +4286,6 @@ fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
|
||||
*/
|
||||
lex->sql_command= old_lex->sql_command;
|
||||
|
||||
(void) read_statistics_for_tables_if_needed(thd, table_list);
|
||||
thd->force_read_stats= false;
|
||||
|
||||
DEBUG_SYNC(thd, "after_open_table_ignore_flush");
|
||||
|
||||
/*
|
||||
@ -6165,6 +6161,7 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables,
|
||||
KEY *key_info=show_table->s->key_info;
|
||||
if (show_table->file)
|
||||
{
|
||||
(void) read_statistics_for_tables(thd, tables);
|
||||
show_table->file->info(HA_STATUS_VARIABLE |
|
||||
HA_STATUS_NO_LOCK |
|
||||
HA_STATUS_TIME);
|
||||
|
Reference in New Issue
Block a user