1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-12420 max_recursive_iterations did not prevent a stack-overflow and segfault

post-review fixes
* move pcre-specific variable out of mysys
* don't use current_thd
* move a commonly used macro to my_sys.h
* remove new sysvar
This commit is contained in:
Sergei Golubchik
2017-05-11 19:48:42 +02:00
parent 602b5e4c49
commit 52aa200919
10 changed files with 24 additions and 46 deletions

View File

@ -6163,12 +6163,6 @@ bool check_fk_parent_table_access(THD *thd,
****************************************************************************/
#if STACK_DIRECTION < 0
#define used_stack(A,B) (long) (A - B)
#else
#define used_stack(A,B) (long) (B - A)
#endif
#ifndef DBUG_OFF
long max_stack_used;
#endif
@ -6185,7 +6179,7 @@ bool check_stack_overrun(THD *thd, long margin,
{
long stack_used;
DBUG_ASSERT(thd == current_thd);
if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
if ((stack_used= available_stack_size(thd->thread_stack, &stack_used)) >=
(long) (my_thread_stack_size - margin))
{
thd->is_fatal_error= 1;
@ -6208,14 +6202,6 @@ bool check_stack_overrun(THD *thd, long margin,
return 0;
}
long check_stack_available(long margin,
uchar *buf __attribute__((unused)))
{
long stack_top;
DBUG_ASSERT(current_thd);
return my_thread_stack_size - margin \
- used_stack(current_thd->thread_stack,(char*) &stack_top);
}
#define MY_YACC_INIT 1000 // Start with big alloc
#define MY_YACC_MAX 32000 // Because of 'short'