List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:January 17 2011 12:26pm
Subject:bzr commit into mysql-5.5 branch (alexander.barkov:3258)
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-5.5/ based on revid:hezx@stripped

 3258 Alexander Barkov	2011-01-17 [merge]
      Merging from 5.1.

    modified:
      mysql-test/r/ctype_many.result
      mysql-test/t/ctype_many.test
      sql/item_strfunc.cc
      sql/item_strfunc.h
=== modified file 'mysql-test/r/ctype_many.result'
--- a/mysql-test/r/ctype_many.result	2010-12-15 09:58:37 +0000
+++ b/mysql-test/r/ctype_many.result	2011-01-17 12:26:13 +0000
@@ -1684,6 +1684,21 @@ ARMENIAN CAPIT ECH	2
 ARMENIAN CAPIT ZA	2
 DROP TABLE t1;
 #
+# Start of 5.1 tests
+#
+#
+# Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
+#
+SET NAMES latin1;
+DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) 
+AS BINARY(0)) USING utf8);
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'Zpq'
+Warning	1292	Truncated incorrect BINARY(0) value: '1.'
+#
+# End of 5.1 tests
+#
+#
 # Start of 5.5 tests
 #
 #

=== modified file 'mysql-test/t/ctype_many.test'
--- a/mysql-test/t/ctype_many.test	2010-12-15 09:58:37 +0000
+++ b/mysql-test/t/ctype_many.test	2011-01-17 12:26:13 +0000
@@ -217,6 +217,21 @@ DROP TABLE t1;
 
 
 --echo #
+--echo # Start of 5.1 tests
+--echo #
+
+--echo #
+--echo # Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
+--echo #
+
+SET NAMES latin1;
+DO CONVERT(CAST(SUBSTRING_INDEX(FORMAT(1,'1111'), FORMAT('','Zpq'),1) 
+                AS BINARY(0)) USING utf8);
+--echo #
+--echo # End of 5.1 tests
+--echo #
+
+--echo #
 --echo # Start of 5.5 tests
 --echo #
 

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-01-13 08:07:21 +0000
+++ b/sql/item_strfunc.cc	2011-01-17 12:26:13 +0000
@@ -2959,22 +2959,16 @@ String *Item_func_conv_charset::val_str(
   DBUG_ASSERT(fixed == 1);
   if (use_cached_value)
     return null_value ? 0 : &str_value;
-  /* 
-    Here we don't pass 'str' as a parameter to args[0]->val_str()
-    as 'str' may point to 'str_value' (e.g. see Item::save_in_field()),
-    which we use below to convert string. 
-    Use argument's 'str_value' instead.
-  */
-  String *arg= args[0]->val_str(&args[0]->str_value);
+  String *arg= args[0]->val_str(str);
   uint dummy_errors;
   if (!arg)
   {
     null_value=1;
     return 0;
   }
-  null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),
+  null_value= tmp_value.copy(arg->ptr(), arg->length(), arg->charset(),
                              conv_charset, &dummy_errors);
-  return null_value ? 0 : check_well_formed_result(&str_value);
+  return null_value ? 0 : check_well_formed_result(&tmp_value);
 }
 
 void Item_func_conv_charset::fix_length_and_dec()

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2011-01-13 08:07:21 +0000
+++ b/sql/item_strfunc.h	2011-01-17 12:26:13 +0000
@@ -791,6 +791,7 @@ public:
 class Item_func_conv_charset :public Item_str_func
 {
   bool use_cached_value;
+  String tmp_value;
 public:
   bool safe;
   CHARSET_INFO *conv_charset; // keep it public

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into mysql-5.5 branch (alexander.barkov:3258) Alexander Barkov17 Jan