MCPcopy Create free account
hub / github.com/MariaDB/server / check_stack_overrun

Function check_stack_overrun

sql/sql_parse.cc:7354–7383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7352__attribute__((optimize("-O0")))
7353#endif
7354check_stack_overrun(THD *thd, long margin, uchar *buf __attribute__((unused)))
7355{
7356#ifndef __SANITIZE_ADDRESS__
7357 long stack_used;
7358 DBUG_ASSERT(thd == current_thd);
7359 DBUG_ASSERT(thd->thread_stack);
7360 if ((stack_used= available_stack_size(thd->thread_stack,
7361 my_get_stack_pointer(&stack_used))) >=
7362 (long) (my_thread_stack_size - margin))
7363 {
7364 thd->is_fatal_error= 1;
7365 /*
7366 Do not use stack for the message buffer to ensure correct
7367 behaviour in cases we have close to no stack left.
7368 */
7369 char* ebuff= new char[MYSQL_ERRMSG_SIZE];
7370 if (ebuff) {
7371 my_snprintf(ebuff, MYSQL_ERRMSG_SIZE, ER_THD(thd, ER_STACK_OVERRUN_NEED_MORE),
7372 stack_used, my_thread_stack_size, margin);
7373 my_message(ER_STACK_OVERRUN_NEED_MORE, ebuff, MYF(ME_FATAL));
7374 delete [] ebuff;
7375 }
7376 return 1;
7377 }
7378#ifndef DBUG_OFF
7379 max_stack_used= MY_MAX(max_stack_used, stack_used);
7380#endif
7381#endif /* __SANITIZE_ADDRESS__ */
7382 return 0;
7383}
7384
7385
7386#define MY_YACC_INIT 1000 // Start with big alloc

Callers 15

add_extra_depsFunction · 0.85
fix_fieldsMethod · 0.85
fix_fieldsMethod · 0.85
fix_fieldsMethod · 0.85
set_lock_typeMethod · 0.85
setup_two_handlersMethod · 0.85
executeMethod · 0.85
test_quick_selectMethod · 0.85

Calls 3

my_get_stack_pointerFunction · 0.85
my_snprintfFunction · 0.85
my_messageFunction · 0.85

Tested by 1

test_quick_selectMethod · 0.68