MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:February 23 2007 5:44pm
Subject:bk commit into 5.0 tree (evgen:1.2418) BUG#23800
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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@stripped, 2007-02-23 20:44:31+03:00, evgen@stripped +4 -0
  item.h:
    Post fix for bug#23800.
    Added the subselect_items_processor() method to the Item class.
  item_subselect.h, item_subselect.cc:
    Post fix for bug#23800.
    Added function Item_subselect::subselect_items_processor().
  sql_lex.cc:
    Post fix for bug#23800.
    A subselect might add fields it refers to to the outer selects'
    ref_pointer_array. Not taking this into account in the 
    st_select_lex::setup_ref_array() function may lead to a memory corruption
    and to a crash.

  sql/item.h@stripped, 2007-02-22 23:19:04+03:00, evgen@stripped +1 -1
    Post fix for bug#23800.
    Added the subselect_items_processor() method to the Item class.

  sql/item_subselect.cc@stripped, 2007-02-22 23:20:48+03:00, evgen@stripped +8 -0
    Post fix for bug#23800.
    Added function Item_subselect::subselect_items_processor().

  sql/item_subselect.h@stripped, 2007-02-23 20:33:18+03:00, evgen@stripped +1 -0
    Post fix for bug#23800.
    Added function Item_subselect::subselect_items_processor().

  sql/sql_lex.cc@stripped, 2007-02-23 20:42:18+03:00, evgen@stripped +8 -0
    Post fix for bug#23800.
    A subselect might add fields it refers to to the outer selects'
    ref_pointer_array. Not taking this into account in the 
    st_select_lex::setup_ref_array() function may lead to a memory corruption
    and to a crash.

# 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:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/23800-bug1-5.0-opt-mysql

--- 1.222/sql/item.h	2007-02-21 23:18:15 +03:00
+++ 1.223/sql/item.h	2007-02-22 23:19:04 +03:00
@@ -790,7 +790,7 @@
       *arg= NULL; 
     return TRUE;     
   }
-
+  virtual bool subselect_items_processor(byte *arg) { return 0; }
   virtual Item *equal_fields_propagator(byte * arg) { return this; }
   virtual bool set_no_const_sub(byte *arg) { return FALSE; }
   virtual Item *replace_equal_field(byte * arg) { return this; }

--- 1.212/sql/sql_lex.cc	2007-02-21 23:00:04 +03:00
+++ 1.213/sql/sql_lex.cc	2007-02-23 20:42:18 +03:00
@@ -1538,9 +1538,16 @@
 
 bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num)
 {
+  uint subselect_items= 0;
+  List_iterator<Item> li(item_list);
+  Item *item;
+
   if (ref_pointer_array)
     return 0;
 
+  /* Count fields that might be stored by subselects in the ref_pointer_array.*/
+  while ((item= li++))
+    item->walk(&Item::subselect_items_processor,(byte*)&subselect_items);
   /*
     We have to create array in prepared statement memory if it is
     prepared statement
@@ -1550,6 +1557,7 @@
           (Item **)arena->alloc(sizeof(Item*) * (n_child_sum_items +
                                                  item_list.elements +
                                                  select_n_having_items +
+                                                 subselect_items +
                                                  order_group_num)*5)) == 0;
 }
 

--- 1.151/sql/item_subselect.cc	2007-01-26 09:50:46 +03:00
+++ 1.152/sql/item_subselect.cc	2007-02-22 23:20:48 +03:00
@@ -232,6 +232,14 @@
   return const_item_cache;
 }
 
+
+bool Item_subselect::subselect_items_processor(byte *arg)
+{
+  for (SELECT_LEX *lex= unit->first_select(); lex; lex= lex->next_select())
+    (*(uint*)arg)+= lex->select_n_having_items;
+}
+
+
 Item *Item_subselect::get_tmp_table_item(THD *thd)
 {
   if (!with_sum_func && !const_item())

--- 1.86/sql/item_subselect.h	2007-01-12 23:22:37 +03:00
+++ 1.87/sql/item_subselect.h	2007-02-23 20:33:18 +03:00
@@ -125,6 +125,7 @@
   */
   virtual void reset_value_registration() {}
   enum_parsing_place place() { return parsing_place; }
+  virtual bool subselect_items_processor(byte *arg);
 
   friend class select_subselect;
   friend class Item_in_optimizer;
Thread
bk commit into 5.0 tree (evgen:1.2418) BUG#23800eugene23 Feb