mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-17869 AddressSanitizer: use-after-poison in Item_change_list::rollback_item_tree_changes
it's incorrect to use change_item_tree() to replace arguments of top-level AND/OR, because they (arguments) are stored in a List, so a pointer to an argument is in the list_node, and individual list_node's of top-level AND/OR can be deleted in Item_cond::build_equal_items(). In that case rollback_item_tree_changes() will modify the deleted object. Luckily, it's not needed to use change_item_tree() for top-level AND/OR, because the whole top-level item is copied and preserved in prep_where and prep_on, and restored from there. So, just don't. Additionally to the test case in the commit it fixes * ASAN failure of main.opt_tvc --ps * ASAN failure of main.having_cond_pushdown --ps
This commit is contained in:
@ -10042,9 +10042,8 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond)
|
||||
*/
|
||||
if (cond->get_extraction_flag() == FULL_EXTRACTION_FL)
|
||||
{
|
||||
Item *result= cond->transform(thd,
|
||||
&Item::multiple_equality_transformer,
|
||||
(uchar *)this);
|
||||
Item *result= cond->top_level_transform(thd,
|
||||
&Item::multiple_equality_transformer, (uchar *)this);
|
||||
if (!result)
|
||||
return true;
|
||||
if (result->type() == Item::COND_ITEM &&
|
||||
|
Reference in New Issue
Block a user