List:Internals« Previous MessageNext Message »
From:pem Date:May 31 2005 10:30am
Subject:bk commit into 5.0 tree (pem:1.1936) BUG#9937
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1936 05/05/31 12:06:15 pem@stripped +8 -0
  Post-review fixes of BUG#9937: Crash on call to stored procedure.

  sql/table.cc
    1.167 05/05/31 12:06:09 pem@stripped +1 -1
    Put the buff parameter back in check_stack_overrun().

  sql/sql_parse.cc
    1.439 05/05/31 12:06:09 pem@stripped +8 -1
    Put the buff parameter back in check_stack_overrun(), and added comment explaining the purpose.

  sql/sp_head.cc
    1.140 05/05/31 12:06:09 pem@stripped +1 -1
    Put the buff parameter back in check_stack_overrun().

  sql/mysqld.cc
    1.461 05/05/31 12:06:09 pem@stripped +8 -4
    Style fixes.

  sql/mysql_priv.h
    1.303 05/05/31 12:06:09 pem@stripped +2 -2
    Put the buff parameter back in check_stack_overrun().

  sql/item_subselect.cc
    1.102 05/05/31 12:06:09 pem@stripped +1 -1
    Put the buff parameter back in check_stack_overrun().

  sql/item_func.cc
    1.202 05/05/31 12:06:09 pem@stripped +8 -2
    Put the buff parameter back in check_stack_overrun().

  sql/item_cmpfunc.cc
    1.148 05/05/31 12:06:09 pem@stripped +1 -1
    Put the buff parameter back in check_stack_overrun().

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	pem
# Host:	mysql.comhem.se
# Root:	/home/pem/work/mysql-5.0

--- 1.147/sql/item_cmpfunc.cc	Mon May 30 11:06:20 2005
+++ 1.148/sql/item_cmpfunc.cc	Tue May 31 12:06:09 2005
@@ -2321,7 +2321,7 @@
   */
   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.

--- 1.201/sql/item_func.cc	Mon May 30 11:06:21 2005
+++ 1.202/sql/item_func.cc	Tue May 31 12:06:09 2005
@@ -293,11 +293,14 @@
 {
   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 @@
 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.302/sql/mysql_priv.h	Mon May 30 11:06:21 2005
+++ 1.303/sql/mysql_priv.h	Tue May 31 12:06:09 2005
@@ -1429,11 +1429,11 @@
 #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 */

--- 1.460/sql/mysqld.cc	Mon May 30 11:06:21 2005
+++ 1.461/sql/mysqld.cc	Tue May 31 12:06:09 2005
@@ -2091,8 +2091,10 @@
   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 @@
   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);

--- 1.438/sql/sql_parse.cc	Mon May 30 11:06:22 2005
+++ 1.439/sql/sql_parse.cc	Tue May 31 12:06:09 2005
@@ -4986,7 +4986,14 @@
 #endif
 
 #ifndef EMBEDDED_LIBRARY
-bool check_stack_overrun(THD *thd, long margin)
+/*
+  Note: The 'buf' parameter is necessary, even if it is unused here.
+  - fix_fields functions has a "dummy" buffer large enough for the
+    corresponding exec. (Thus we only have to check in fix_fields.)
+  - Passing to check_stack_overrun() prevents the compiler from removing it.
+ */
+bool check_stack_overrun(THD *thd, long margin,
+			 char *buf __attribute__((unused)))
 {
   long stack_used;
   if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=

--- 1.166/sql/table.cc	Thu May 26 20:35:03 2005
+++ 1.167/sql/table.cc	Tue May 31 12:06:09 2005
@@ -1815,7 +1815,7 @@
   bool res= FALSE;
   DBUG_ENTER("st_table_list::setup_ancestor");
 
-  if (check_stack_overrun(thd, STACK_MIN_SIZE))
+  if (check_stack_overrun(thd, STACK_MIN_SIZE, (char *)&res))
     return TRUE;
 
   for (tbl= ancestor; tbl; tbl= tbl->next_local)

--- 1.101/sql/item_subselect.cc	Mon May 30 11:06:21 2005
+++ 1.102/sql/item_subselect.cc	Tue May 31 12:06:09 2005
@@ -138,7 +138,7 @@
   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();

--- 1.139/sql/sp_head.cc	Mon May 30 11:06:22 2005
+++ 1.140/sql/sp_head.cc	Tue May 31 12:06:09 2005
@@ -565,7 +565,7 @@
   String old_packet;
 
   /* Use some extra margin for possible SP recursion and functions */
-  if (check_stack_overrun(thd, 4*STACK_MIN_SIZE))
+  if (check_stack_overrun(thd, 4*STACK_MIN_SIZE, olddb))
   {
     DBUG_RETURN(-1);
   }
Thread
bk commit into 5.0 tree (pem:1.1936) BUG#9937pem31 May