summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-10-21 15:41:13 +0700
committerDmitry Shulga <Dmitry.Shulga@Sun.COM>2010-10-21 15:41:13 +0700
commit89e43c84943da707d72f168c48b86c41f8a05aff (patch)
tree0c9772ec45e046e8dc88c8cd6eb0372223cff4cc /sql/sp_head.cc
parent2d77e26d0bba005eedc53b3edc4ac7c0e18d6331 (diff)
downloadmariadb-git-89e43c84943da707d72f168c48b86c41f8a05aff.tar.gz
Fixed bug#45445 - cannot execute procedures with thread_stack
set to 128k. sql/sp.cc: Added checking for stack overrun at functions db_load_routine/sp_find_routine. sql/sp_head.cc: sp_head::execute() modified: pass constant value STACK_MIN_SIZE instead of 8 * STACK_MIN_SIZE as second argument value in call to check_stack_overrun. Added checking for stack overrun at functions sp_lex_keeper::reset_lex_and_exec_core/sp_instr_stmt::execute. sql/sql_parse.cc: check_stack_overrun modified: allocate buffer for error message at heap instead of stack. parse_sql modified: added call to check_stack_overrun() before parsing of sql statement.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 1fd4e9302c4..379e81d406e 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1233,11 +1233,8 @@ sp_head::execute(THD *thd)
The same with db_load_routine() required circa 7k bytes and
14k bytes accordingly. Hence, here we book the stack with some
reasonable margin.
-
- Reverting back to 8 * STACK_MIN_SIZE until further fix.
- 8 * STACK_MIN_SIZE is required on some exotic platforms.
*/
- if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet))
+ if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&old_packet))
DBUG_RETURN(TRUE);
/* init per-instruction memroot */
@@ -2902,6 +2899,9 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
It's merged with the saved parent's value at the exit of this func.
*/
bool parent_modified_non_trans_table= thd->transaction.stmt.modified_non_trans_table;
+ if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&parent_modified_non_trans_table))
+ DBUG_RETURN(TRUE);
+
thd->transaction.stmt.modified_non_trans_table= FALSE;
DBUG_ASSERT(!thd->derived_tables);
DBUG_ASSERT(thd->change_list.is_empty());
@@ -3057,6 +3057,9 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
DBUG_ENTER("sp_instr_stmt::execute");
DBUG_PRINT("info", ("command: %d", m_lex_keeper.sql_command()));
+ if (check_stack_overrun(thd, STACK_MIN_SIZE, (uchar*)&res))
+ DBUG_RETURN(TRUE);
+
query= thd->query();
query_length= thd->query_length();
#if defined(ENABLED_PROFILING)