From e451c5023d3b264be1694f1fe85a71756eed4bb5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 12:48:26 +0100 Subject: Bug#43201 : Stack overrun when running sp-error test. It appears that stack overflow checks for recusrive stored procedure calls, that run in the normal server, did not work in embedded and were dummified with preprocessor magic( #ifndef EMBEDDED_SERVER ). The fix is to remove ifdefs, there is no reason not to run overflow checks and crash in deeply recursive calls. Note: Start of the stack (thd->thread_stack variable) in embedded is not necessarily exact but stil provides the best guess. Unless the caller of mysql_read_connect() is already deep in the stack, thd->thread_stack variable should approximate stack start address well. --- sql/item_func.cc | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sql/item_func.cc') diff --git a/sql/item_func.cc b/sql/item_func.cc index 75f8b2045b5..e49ee4346b1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -151,9 +151,7 @@ Item_func::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); Item **arg,**arg_end; -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif used_tables_cache= not_null_tables_cache= 0; const_item_cache=1; @@ -2839,9 +2837,7 @@ bool udf_handler::fix_fields(THD *thd, Item_result_field *func, uint arg_count, Item **arguments) { -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif DBUG_ENTER("Item_udf_func::fix_fields"); if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) -- cgit v1.2.1