From 0168d1eda30dad4b517659422e347175eb89e923 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 15 Sep 2021 16:06:02 +0200 Subject: MDEV-25766 Unused CTE lead to a crash in find_field_in_tables/find_order_in_list Do not assume that subquery Item always present. --- sql/sql_base.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 248dedf36e4..a6c07600591 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -6011,9 +6011,10 @@ find_field_in_tables(THD *thd, Item_ident *item, sl=sl->outer_select()) { Item *subs= sl->master_unit()->item; - if (subs->type() == Item::SUBSELECT_ITEM && - ((Item_subselect*)subs)->substype() == Item_subselect::IN_SUBS && - ((Item_in_subselect*)subs)->test_strategy(SUBS_SEMI_JOIN)) + if (!subs || + (subs->type() == Item::SUBSELECT_ITEM && + ((Item_subselect*)subs)->substype() == Item_subselect::IN_SUBS && + ((Item_in_subselect*)subs)->test_strategy(SUBS_SEMI_JOIN))) { continue; } -- cgit v1.2.1