Commit 2e113ada authored by unknown's avatar unknown
Browse files

Post-review fixes of BUG#9937: Crash on call to stored procedure.


sql/item_cmpfunc.cc:
  Put the buff parameter back in check_stack_overrun().
sql/item_func.cc:
  Put the buff parameter back in check_stack_overrun().
sql/item_subselect.cc:
  Put the buff parameter back in check_stack_overrun().
sql/mysql_priv.h:
  Put the buff parameter back in check_stack_overrun().
sql/mysqld.cc:
  Style fixes.
sql/sp_head.cc:
  Put the buff parameter back in check_stack_overrun().
sql/sql_parse.cc:
  Put the buff parameter back in check_stack_overrun(), and added comment explaining the purpose.
sql/table.cc:
  Put the buff parameter back in check_stack_overrun().
parent 4701bd90
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2321,7 +2321,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
  */
  and_tables_cache= ~(table_map) 0;

  if (check_stack_overrun(thd, STACK_MIN_SIZE))
  if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
    return TRUE;				// Fatal error flag is set!
  /*
    The following optimization reduces the depth of an AND-OR tree.
+8 −2
Original line number Diff line number Diff line
@@ -293,11 +293,14 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
  DBUG_ASSERT(fixed == 0);
  Item **arg,**arg_end;
#ifndef EMBEDDED_LIBRARY			// Avoid compiler warning
  char buff[STACK_BUFF_ALLOC];			// Max argument in function
#endif

  used_tables_cache= not_null_tables_cache= 0;
  const_item_cache=1;

  if (check_stack_overrun(thd, STACK_MIN_SIZE+STACK_BUFF_ALLOC))
  if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
    return TRUE;				// Fatal error if flag is set!
  if (arg_count)
  {						// Print purify happy
@@ -2564,9 +2567,12 @@ bool
udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
			uint arg_count, Item **arguments)
{
#ifndef EMBEDDED_LIBRARY			// Avoid compiler warning
  char buff[STACK_BUFF_ALLOC];			// Max argument in function
#endif
  DBUG_ENTER("Item_udf_func::fix_fields");

  if (check_stack_overrun(thd, STACK_MIN_SIZE+STACK_BUFF_ALLOC))
  if (check_stack_overrun(thd, STACK_MIN_SIZE, buff))
    DBUG_RETURN(TRUE);				// Fatal error flag is set!

  udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1);
+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
  DBUG_ASSERT(fixed == 0);
  engine->set_thd((thd= thd_param));

  if (check_stack_overrun(thd, STACK_MIN_SIZE))
  if (check_stack_overrun(thd, STACK_MIN_SIZE, (gptr)&res))
    return TRUE;

  res= engine->prepare();
+2 −2
Original line number Diff line number Diff line
@@ -1429,11 +1429,11 @@ inline int hexchar_to_int(char c)
#ifndef EMBEDDED_LIBRARY
extern "C" void unireg_abort(int exit_code);
void kill_delayed_threads(void);
bool check_stack_overrun(THD *thd, long margin);
bool check_stack_overrun(THD *thd, long margin, char *dummy);
#else
#define unireg_abort(exit_code) DBUG_RETURN(exit_code)
inline void kill_delayed_threads(void) {}
#define check_stack_overrun(A, B) 0
#define check_stack_overrun(A, B, C) 0
#endif

#endif /* MYSQL_CLIENT */
+8 −4
Original line number Diff line number Diff line
@@ -2091,8 +2091,10 @@ static void start_signal_handler(void)
  if (!(opt_specialflag & SPECIAL_NO_PRIOR))
    my_pthread_attr_setprio(&thr_attr,INTERRUPT_PRIOR);
#if defined(__ia64__) || defined(__ia64)
  /* Peculiar things with ia64 platforms - it seems we only have half the
     stack size in reality, so we have to double it here */
  /*
    Peculiar things with ia64 platforms - it seems we only have half the
    stack size in reality, so we have to double it here
  */
  pthread_attr_setstacksize(&thr_attr,thread_stack*2);
#else
  pthread_attr_setstacksize(&thr_attr,thread_stack);
@@ -3018,8 +3020,10 @@ int main(int argc, char **argv)
  if (!(opt_specialflag & SPECIAL_NO_PRIOR))
    my_pthread_setprio(pthread_self(),CONNECT_PRIOR);
#if defined(__ia64__) || defined(__ia64)
  /* Peculiar things with ia64 platforms - it seems we only have half the
     stack size in reality, so we have to double it here */
  /*
    Peculiar things with ia64 platforms - it seems we only have half the
    stack size in reality, so we have to double it here
  */
  pthread_attr_setstacksize(&connection_attrib,thread_stack*2);
#else
  pthread_attr_setstacksize(&connection_attrib,thread_stack);
Loading