List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:July 16 2009 1:14pm
Subject:bzr commit into mysql-5.0-bugteam branch (joro:2785) Bug#46003 Bug#46034
View as plain text  
#At file:///home/kgeorge/mysql/work/fixvg-5.0-bugteam/ based on revid:joro@stripped

 2785 Georgi Kodinov	2009-07-16
      Bug #46003 and bug #46034: backported the fixes from azalea.

    modified:
      sql/sql_base.cc
      sql/sql_select.cc
      sql/sql_select.h
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2009-06-17 13:54:01 +0000
+++ b/sql/sql_base.cc	2009-07-16 12:19:22 +0000
@@ -5095,7 +5095,13 @@ int setup_wild(THD *thd, TABLE_LIST *tab
     /* make * substituting permanent */
     SELECT_LEX *select_lex= thd->lex->current_select;
     select_lex->with_wild= 0;
-    select_lex->item_list= fields;
+    /*   
+      The assignment below is translated to memcpy() call (at least on some
+      platforms). memcpy() expects that source and destination areas do not
+      overlap. That problem was detected by valgrind. 
+    */
+    if (&select_lex->item_list != &fields)
+      select_lex->item_list= fields;
 
     thd->restore_active_arena(arena, &backup);
   }

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2009-06-17 13:54:01 +0000
+++ b/sql/sql_select.cc	2009-07-16 12:19:22 +0000
@@ -1748,7 +1748,8 @@ JOIN::exec()
       curr_join->having= curr_join->tmp_having= 0; // Allready done
     
     /* Change sum_fields reference to calculated fields in tmp_table */
-    curr_join->all_fields= *curr_all_fields;
+    if (curr_join != this)
+      curr_join->all_fields= *curr_all_fields;
     if (!items1)
     {
       items1= items0 + all_fields.elements;
@@ -1767,8 +1768,11 @@ JOIN::exec()
 				      fields_list.elements, all_fields))
 	  DBUG_VOID_RETURN;
       }
-      curr_join->tmp_all_fields1= tmp_all_fields1;
-      curr_join->tmp_fields_list1= tmp_fields_list1;
+      if (curr_join != this)
+      {
+        curr_join->tmp_all_fields1= tmp_all_fields1;
+        curr_join->tmp_fields_list1= tmp_fields_list1;
+      }
       curr_join->items1= items1;
     }
     curr_all_fields= &tmp_all_fields1;
@@ -1913,8 +1917,11 @@ JOIN::exec()
 				     tmp_fields_list2, tmp_all_fields2, 
 				     fields_list.elements, tmp_all_fields1))
 	  DBUG_VOID_RETURN;
-	curr_join->tmp_fields_list2= tmp_fields_list2;
-	curr_join->tmp_all_fields2= tmp_all_fields2;
+        if (curr_join != this)
+        {
+          curr_join->tmp_fields_list2= tmp_fields_list2;
+          curr_join->tmp_all_fields2= tmp_all_fields2;
+        }
       }
       curr_fields_list= &curr_join->tmp_fields_list2;
       curr_all_fields= &curr_join->tmp_all_fields2;
@@ -1969,8 +1976,11 @@ JOIN::exec()
       tmp_table_param.save_copy_field= curr_join->tmp_table_param.copy_field;
       tmp_table_param.save_copy_field_end=
 	curr_join->tmp_table_param.copy_field_end;
-      curr_join->tmp_all_fields3= tmp_all_fields3;
-      curr_join->tmp_fields_list3= tmp_fields_list3;
+      if (curr_join != this)
+      {
+        curr_join->tmp_all_fields3= tmp_all_fields3;
+        curr_join->tmp_fields_list3= tmp_fields_list3;
+      }
     }
     else
     {

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2009-02-05 09:30:39 +0000
+++ b/sql/sql_select.h	2009-07-16 12:19:22 +0000
@@ -416,7 +416,8 @@ public:
     group_optimized_away= 0;
 
     all_fields= fields_arg;
-    fields_list= fields_arg;
+    if (&fields_list != &fields_arg)      /* Avoid valgrind-warning */
+      fields_list= fields_arg;
     bzero((char*) &keyuse,sizeof(keyuse));
     tmp_table_param.init();
     tmp_table_param.end_write_records= HA_POS_ERROR;


Attachment: [text/bzr-bundle] bzr/joro@sun.com-20090716121922-ropwd1g6zz7png0o.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (joro:2785) Bug#46003 Bug#46034Georgi Kodinov16 Jul