List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:March 29 2011 11:36am
Subject:bzr commit into mysql-5.1 branch (sergey.glukhov:3641) Bug#11766124
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:sergey.glukhov@stripped

 3641 Sergey Glukhov	2011-03-29
      Bug#11766124  59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
      Valgrind warning happens due to missing NULL value check in
      Item::get_date. The fix is to add this check.
     @ mysql-test/r/func_time.result
        test case
     @ mysql-test/t/func_time.test
        test case
     @ sql/item.cc
        added check for NULL value

    modified:
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item.cc
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-03-29 11:15:38 +0000
+++ b/mysql-test/r/func_time.result	2011-03-29 11:36:55 +0000
@@ -1399,4 +1399,10 @@ NULL
 SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
 CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025))
 NULL
+#
+# Bug#11766124  59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
+#
+SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
+ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR)
+NULL
 End of 5.1 tests

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-03-29 11:15:38 +0000
+++ b/mysql-test/t/func_time.test	2011-03-29 11:36:55 +0000
@@ -907,4 +907,10 @@ SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FO
 
 SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025));
 
+--echo #
+--echo # Bug#11766124  59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME
+--echo #
+
+SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR);
+
 --echo End of 5.1 tests

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-03-15 11:36:12 +0000
+++ b/sql/item.cc	2011-03-29 11:36:55 +0000
@@ -926,8 +926,12 @@ bool Item::get_date(MYSQL_TIME *ltime,ui
   }
   else
   {
-    longlong value= val_int();
     int was_cut;
+    longlong value= val_int();
+
+    if (null_value)
+      goto err;
+
     if (number_to_datetime(value, ltime, fuzzydate, &was_cut) == LL(-1))
     {
       char buff[22], *end;


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110329113655-fvm8nymts900u77d.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3641) Bug#11766124Sergey Glukhov29 Mar