1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-28097 use-after-free when WHERE has subquery with an outer reference in HAVING

when resolving WHERE and ON clauses, do not look in
SELECT list/aliases.
This commit is contained in:
Sergei Golubchik
2022-04-29 14:50:47 +02:00
parent 8c34eab968
commit 0beed9b5e9
5 changed files with 26 additions and 6 deletions

View File

@ -8398,9 +8398,11 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
thd->lex->which_check_option_applicable();
bool save_is_item_list_lookup= select_lex->is_item_list_lookup;
TABLE_LIST *derived= select_lex->master_unit()->derived;
bool save_resolve_in_select_list= select_lex->context.resolve_in_select_list;
DBUG_ENTER("setup_conds");
select_lex->is_item_list_lookup= 0;
select_lex->context.resolve_in_select_list= false;
thd->column_usage= MARK_COLUMNS_READ;
DBUG_PRINT("info", ("thd->column_usage: %d", thd->column_usage));
@ -8453,6 +8455,7 @@ int setup_conds(THD *thd, TABLE_LIST *tables, List<TABLE_LIST> &leaves,
select_lex->where= *conds;
}
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
select_lex->context.resolve_in_select_list= save_resolve_in_select_list;
DBUG_RETURN(thd->is_error());
err_no_arena: