List:Commits« Previous MessageNext Message »
From:pem Date:April 11 2006 12:17pm
Subject:bk commit into 5.0 tree (pem:1.2136) BUG#18787
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.2136 06/04/11 12:17:57 pem@stripped +3 -0
  Fixed BUG#18787: Server crashed when calling a stored procedure containing
                   a misnamed function
    ... in the presence of a continue handler. The problem was that with a
    handler, it continued to execute as if function existed and had set a
    useful return value (which it hadn't).
    The fix is to set a null return value and do an error return when a function
    wasn't found.

  sql/item_func.cc
    1.277 06/04/11 12:17:52 pem@stripped +9 -3
    Don't set "out of resources" error in Item_func_sp::execute() if no
    result field is returned, it's simply wrong, it can be sometthing else,
    like a function not found. Instead set null_value and return error.
    Also, set "out of resources" when field creation fails in
    Item_func_sp::sp_result_field() and Item_func_sp::tmp_table_field().

  mysql-test/t/sp.test
    1.182 06/04/11 12:17:52 pem@stripped +18 -0
    New testcase for BUG#18787.

  mysql-test/r/sp.result
    1.194 06/04/11 12:17:52 pem@stripped +10 -0
    Updated results for a new test case (BUG#18787).

# 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:	pem.mysql.com
# Root:	/extern/mysql/5.0/bug18787/mysql-5.0-runtime

--- 1.276/sql/item_func.cc	2006-03-23 21:44:54 +01:00
+++ 1.277/sql/item_func.cc	2006-04-11 12:17:52 +02:00
@@ -4722,7 +4722,9 @@
     share->table_cache_key = empty_name;
     share->table_name = empty_name;
   }
-  field= m_sp->create_result_field(max_length, name, dummy_table);
+  if (!(field= m_sp->create_result_field(max_length, name, dummy_table)))
+    my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+
   DBUG_RETURN(field);
 }
 
@@ -4750,8 +4752,9 @@
   {
     if (!(*flp= f= sp_result_field()))
     {
-      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
-      return 0;
+      /* Error set by sp_result_field() */
+      null_value= 1;
+      return TRUE;
     }
 
     f->move_field((f->pack_length() > sizeof(result_buf)) ?
@@ -4914,6 +4917,9 @@
   
   if (!res) 
     res= Item_func::tmp_table_field(t_arg);
+
+  if (!res)
+    my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
 
   DBUG_RETURN(res);
 }

--- 1.193/mysql-test/r/sp.result	2006-03-28 14:18:44 +02:00
+++ 1.194/mysql-test/r/sp.result	2006-04-11 12:17:52 +02:00
@@ -4837,4 +4837,14 @@
 b	3
 a	1
 delete from t1|
+drop procedure if exists bug18787|
+create procedure bug18787()
+begin
+declare continue handler for sqlexception begin end;
+select no_such_function();
+end|
+call bug18787()|
+no_such_function()
+NULL
+drop procedure bug18787|
 drop table t1,t2;

--- 1.181/mysql-test/t/sp.test	2006-03-28 14:17:15 +02:00
+++ 1.182/mysql-test/t/sp.test	2006-04-11 12:17:52 +02:00
@@ -5684,6 +5684,24 @@
 
 
 #
+# BUG#18787: Server crashed when calling a stored procedure containing
+#            a misnamed function
+#
+--disable_warnings
+drop procedure if exists bug18787|
+--enable_warnings
+create procedure bug18787()
+begin
+  declare continue handler for sqlexception begin end;
+
+  select no_such_function();
+end|
+
+call bug18787()|
+drop procedure bug18787|
+
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
Thread
bk commit into 5.0 tree (pem:1.2136) BUG#18787pem11 Apr