Skip to content

Commit 0248fb2

Browse files
author
Chaithra Gopalareddy
committed
Bug #23135667: CRASH AFTER DEEPLY NESTED BUILD_EQUAL_ITEMS_FOR_COND
Problem: When build_equal_items_for_cond gets called for a big query recursively, the specified thread_stack_size exceeds. But optimizer does not handle this condition. As a result, server exits. Solution: Check if we exceed specified stack size and if yes exit gracefully by throwing an error.
1 parent 0c6eac6 commit 0248fb2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sql/sql_select.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8154,6 +8154,9 @@ static COND *build_equal_items_for_cond(THD *thd, COND *cond,
81548154
COND_EQUAL cond_equal;
81558155
cond_equal.upper_levels= inherited;
81568156

8157+
if (check_stack_overrun(thd, STACK_MIN_SIZE, NULL))
8158+
return cond; // Fatal error flag is set!
8159+
81578160
if (cond->type() == Item::COND_ITEM)
81588161
{
81598162
List<Item> eq_list;

0 commit comments

Comments
 (0)