mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fixed bug mdev-4336.
When iterating over a list of conditions using List_iterator the function remove_eq_conds should skip all predicates that replace a condition from the list. Otherwise it can come to an infinite recursion.
This commit is contained in:
@@ -13197,7 +13197,8 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
||||
else
|
||||
{
|
||||
Item *list_item;
|
||||
Item *new_list_item;
|
||||
Item *new_list_item;
|
||||
uint cnt= new_item_and_list->elements;
|
||||
List_iterator<Item> it(*new_item_and_list);
|
||||
while ((list_item= it++))
|
||||
{
|
||||
@@ -13211,7 +13212,9 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
||||
it.replace(new_list_item);
|
||||
new_list_item->update_used_tables();
|
||||
}
|
||||
li.replace(*new_item_and_list);
|
||||
li.replace(*new_item_and_list);
|
||||
for (cnt--; cnt; cnt--)
|
||||
item= li++;
|
||||
}
|
||||
cond_and_list->concat((List<Item>*) cond_equal_items);
|
||||
}
|
||||
@@ -13232,7 +13235,13 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value)
|
||||
if (new_item->type() == Item::COND_ITEM &&
|
||||
((Item_cond*) new_item)->functype() ==
|
||||
((Item_cond*) cond)->functype())
|
||||
li.replace(*((Item_cond*) new_item)->argument_list());
|
||||
{
|
||||
List<Item> *arg_list= ((Item_cond*) new_item)->argument_list();
|
||||
uint cnt= arg_list->elements;
|
||||
li.replace(*arg_list);
|
||||
for ( cnt--; cnt; cnt--)
|
||||
item= li++;
|
||||
}
|
||||
else
|
||||
li.replace(new_item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user