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

 3635 Sergey Glukhov	2011-03-28
      Bug#11766087  59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
      Valgrind warning happens due to missing NULL value check in
      Item_func::val_decimal. 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_func.cc
        added check for NULL value

    modified:
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item_func.cc
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-03-28 07:53:18 +0000
+++ b/mysql-test/r/func_time.result	2011-03-28 11:06:24 +0000
@@ -1381,4 +1381,10 @@ DROP TABLE t1;
 SELECT STR_TO_DATE(SPACE(2),'1');
 STR_TO_DATE(SPACE(2),'1')
 0000-00-00
+#
+# Bug#11766087  59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
+#
+SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
+FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1)
+NULL
 End of 5.1 tests

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-03-28 07:53:18 +0000
+++ b/mysql-test/t/func_time.test	2011-03-28 11:06:24 +0000
@@ -887,4 +887,10 @@ DROP TABLE t1;
 
 SELECT STR_TO_DATE(SPACE(2),'1');
 
+--echo #
+--echo # Bug#11766087  59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL
+--echo #
+
+SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1);
+
 --echo End of 5.1 tests

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-03-28 08:35:50 +0000
+++ b/sql/item_func.cc	2011-03-28 11:06:24 +0000
@@ -482,7 +482,10 @@ bool Item_func::is_expensive_processor(u
 my_decimal *Item_func::val_decimal(my_decimal *decimal_value)
 {
   DBUG_ASSERT(fixed);
-  int2my_decimal(E_DEC_FATAL_ERROR, val_int(), unsigned_flag, decimal_value);
+  longlong nr= val_int();
+  if (null_value)
+    return 0; /* purecov: inspected */
+  int2my_decimal(E_DEC_FATAL_ERROR, nr, unsigned_flag, decimal_value);
   return decimal_value;
 }
 


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110328110624-p0jnyqsvkndh0n72.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3635) Bug#11766087Sergey Glukhov28 Mar