mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-31764: ASAN use-after-poison in trace_engine_stats in ANALYZE JSON
Do not attempt to produce "r_engine_stats" on the temporary (=work) tables. These tables may be - re-created during the query execution - freed during the query execution (This is done e.g. in JOIN::cleanup(), before we produce ANALYZE FORMAT=JSON output). - (Also, make save_explain_data() functions not set handler_for_stats to point to handler objects that do not have handler->handler_stats set. If the storage engine is not collecting handler_stats, it will not have them when we're producing ANALYZE FORMAT=JSON output, either).
This commit is contained in:
@@ -124,9 +124,12 @@ bool Update_plan::save_explain_data_intern(THD *thd,
|
||||
if (is_analyze ||
|
||||
(thd->variables.log_slow_verbosity &
|
||||
LOG_SLOW_VERBOSITY_ENGINE))
|
||||
{
|
||||
table->file->set_time_tracker(&explain->table_tracker);
|
||||
|
||||
explain->handler_for_stats= table->file;
|
||||
if (table->file->handler_stats && table->s->tmp_table != INTERNAL_TMP_TABLE)
|
||||
explain->handler_for_stats= table->file;
|
||||
}
|
||||
|
||||
select_lex->set_explain_type(TRUE);
|
||||
explain->select_type= select_lex->type;
|
||||
|
Reference in New Issue
Block a user