List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:June 15 2011 6:38am
Subject:bzr commit into mysql-5.1 branch (sergey.glukhov:3648) Bug#12634989
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:marko.makela@stripped

 3648 Sergey Glukhov	2011-06-15
      Bug#12634989 VALGRIND WARNING ABOUT UNINITIALIZED VALUES CREATED IN ITEM_FUNC_DAYOFMONTH
      added missing null value check
     @ mysql-test/r/func_str.result
        test case
     @ mysql-test/t/func_str.test
        test case
     @ sql/item_strfunc.cc
        added missing null value check

    modified:
      mysql-test/r/func_str.result
      mysql-test/t/func_str.test
      sql/item_strfunc.cc
=== modified file 'mysql-test/r/func_str.result'
--- a/mysql-test/r/func_str.result	2011-01-13 07:57:15 +0000
+++ b/mysql-test/r/func_str.result	2011-06-15 06:38:11 +0000
@@ -2628,4 +2628,10 @@ SELECT * FROM t1;
 a
 aaaaaaaaaaaaaa
 DROP TABLE t1;
+#
+# Bug#12634989 VALGRIND WARNING ABOUT UNINITIALIZED VALUES CREATED IN ITEM_FUNC_DAYOFMONTH
+#
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+SUBSTRING('1', DAY(FROM_UNIXTIME(-1)))
+NULL
 End of 5.1 tests

=== modified file 'mysql-test/t/func_str.test'
--- a/mysql-test/t/func_str.test	2011-01-13 07:57:15 +0000
+++ b/mysql-test/t/func_str.test	2011-06-15 06:38:11 +0000
@@ -1380,4 +1380,10 @@ LOAD DATA INFILE 'bug58165.txt' INTO TAB
 SELECT * FROM t1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#12634989 VALGRIND WARNING ABOUT UNINITIALIZED VALUES CREATED IN ITEM_FUNC_DAYOFMONTH
+--echo #
+
+SELECT SUBSTRING('1', DAY(FROM_UNIXTIME(-1)));
+
 --echo End of 5.1 tests

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-05-16 20:04:01 +0000
+++ b/sql/item_strfunc.cc	2011-06-15 06:38:11 +0000
@@ -1266,6 +1266,8 @@ void Item_func_substr::fix_length_and_de
   if (args[1]->const_item())
   {
     int32 start= (int32) args[1]->val_int();
+    if (args[1]->null_value)
+      goto end;
     if (start < 0)
       max_length= ((uint)(-start) > max_length) ? 0 : (uint)(-start);
     else
@@ -1274,11 +1276,15 @@ void Item_func_substr::fix_length_and_de
   if (arg_count == 3 && args[2]->const_item())
   {
     int32 length= (int32) args[2]->val_int();
+    if (args[2]->null_value)
+      goto end;
     if (length <= 0)
       max_length=0; /* purecov: inspected */
     else
       set_if_smaller(max_length,(uint) length);
   }
+
+end:
   max_length*= collation.collation->mbmaxlen;
 }
 


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110615063811-bwjmtltmziseclv9.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3648) Bug#12634989Sergey Glukhov15 Jun