List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:February 11 2011 9:16am
Subject:bzr commit into mysql-trunk branch (tor.didriksen:3639) Bug#59686
View as plain text  
#At file:///export/home/didrik/repo/trunk/ based on revid:alexander.barkov@stripped

 3639 Tor Didriksen	2011-02-11 [merge]
      merge Bug #59686 from 5.5

    modified:
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item_sum.cc
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-02-02 18:31:39 +0000
+++ b/mysql-test/r/func_time.result	2011-02-11 09:15:52 +0000
@@ -1400,3 +1400,15 @@ SELECT SUBDATE(STR_TO_DATE(NULL,0), INTE
 SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR)
 NULL
 #
+# Bug #59686 crash in String::copy() with time data type
+#
+SELECT min(timestampadd(month, 1>'', from_days('%Z')));
+min(timestampadd(month, 1>'', from_days('%Z')))
+NULL
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '%Z'
+create table t1(a time);
+insert into t1 values ('00:00:00'),('00:01:00');
+select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
+1
+drop table t1;

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-02-02 18:31:39 +0000
+++ b/mysql-test/t/func_time.test	2011-02-11 09:15:52 +0000
@@ -902,4 +902,12 @@ SELECT WEEK(STR_TO_DATE(NULL,0));
 SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
 
 --echo #
+--echo # Bug #59686 crash in String::copy() with time data type
+--echo #
+
+SELECT min(timestampadd(month, 1>'', from_days('%Z')));
 
+create table t1(a time);
+insert into t1 values ('00:00:00'),('00:01:00');
+select 1 from t1 where 1 < some (select cast(a as datetime) from t1);
+drop table t1;

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2011-02-02 09:21:41 +0000
+++ b/sql/item_sum.cc	2011-02-11 09:15:52 +0000
@@ -1903,7 +1903,10 @@ double Item_sum_hybrid::val_real()
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0.0;
-  return value->val_real();
+  double retval= value->val_real();
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == 0.0);
+  return retval;
 }
 
 longlong Item_sum_hybrid::val_int()
@@ -1911,7 +1914,10 @@ longlong Item_sum_hybrid::val_int()
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_int();
+  longlong retval= value->val_int();
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == 0);
+  return retval;
 }
 
 
@@ -1920,7 +1926,10 @@ my_decimal *Item_sum_hybrid::val_decimal
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_decimal(val);
+  my_decimal *retval= value->val_decimal(val);
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == NULL);
+  return retval;
 }
 
 
@@ -1930,7 +1939,10 @@ Item_sum_hybrid::val_str(String *str)
   DBUG_ASSERT(fixed == 1);
   if (null_value)
     return 0;
-  return value->val_str(str);
+  String *retval= value->val_str(str);
+  if ((null_value= value->null_value))
+    DBUG_ASSERT(retval == NULL);
+  return retval;
 }
 
 

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-trunk branch (tor.didriksen:3639) Bug#59686Tor Didriksen11 Feb