1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Fixed BUG#9937: Crash on call to stored procedure.

This only showed up on two known platforms, both ia64 (one HP-UX and one Linux wich icc).
For some reason, they only get half the stack size they are supposed to have, which
makes deep SP recursion overrun the stack before check_stack_overrun() is triggered.
Also made som minor fixes in the check_stack_overrun() definition, supporting variable
margins.
No test case added, but the reason for the bug report was a failed existing test case
on these machines, which now works.


sql/item_cmpfunc.cc:
  Adopted call to new check_stack_overrun() definition.
sql/item_func.cc:
  Adopted calls to new check_stack_overrun() definition.
sql/item_subselect.cc:
  Adopted call to new check_stack_overrun() definition.
sql/mysql_priv.h:
  Changed definition of check_stack_overrun(), thread_stack_min variable no longer needed.
sql/mysqld.cc:
  thread_stack_min variable no longer needed (with variable margin arg. to check_thread_overrun()).
  On (at least some) ia64 machines, it seems we only get half the requested stack in reality,
  so deep SP recursion crashes before the thread overrun check is triggered.
  We work around this by requesting twice the stack requested to get expected size.
sql/sp_head.cc:
  Adopted call to new check_stack_overrun() definition, and use a wider margin
  execution.
sql/sql_parse.cc:
  Modified check_stack_overrun() definition. Removed unused arg that didn't sever any
  purpose, and added a 'margin' argument to support different margins for different
  callrers.
sql/table.cc:
  Adopted call to new check_stack_overrun() definition.
This commit is contained in:
unknown
2005-05-26 20:36:14 +02:00
parent d4be3ae2a3
commit 0d8dce039b
8 changed files with 32 additions and 22 deletions

View File

@@ -4985,11 +4985,11 @@ long max_stack_used;
#endif
#ifndef EMBEDDED_LIBRARY
bool check_stack_overrun(THD *thd,char *buf __attribute__((unused)))
bool check_stack_overrun(THD *thd, long margin)
{
long stack_used;
if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
(long) thread_stack_min)
thread_stack - margin)
{
sprintf(errbuff[0],ER(ER_STACK_OVERRUN),stack_used,thread_stack);
my_message(ER_STACK_OVERRUN,errbuff[0],MYF(0));