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

 3618 Sergey Glukhov	2011-03-22
      Bug#11765216  58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
      Valgrind warning happens due to uninitialized cached_format_type field
      which is used later in Item_func_str_to_date::val_str method.
      The fix is to init cached_format_type field. 
     @ mysql-test/r/func_time.result
        test case
     @ mysql-test/t/func_time.test
        test case
     @ sql/item_timefunc.cc
        init cached_format_type field

    modified:
      mysql-test/r/func_time.result
      mysql-test/t/func_time.test
      sql/item_timefunc.cc
=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2011-02-02 18:13:11 +0000
+++ b/mysql-test/r/func_time.result	2011-03-22 11:02:27 +0000
@@ -1375,4 +1375,10 @@ Warning	1292	Truncated incorrect time va
 Warning	1292	Truncated incorrect time value: ''
 Warning	1292	Truncated incorrect time value: ''
 DROP TABLE t1;
+#
+# Bug#11765216  58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
+#
+SET GLOBAL SQL_MODE='';
+DO  STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
+SET GLOBAL SQL_MODE=DEFAULT;
 End of 5.1 tests

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2011-02-02 18:13:11 +0000
+++ b/mysql-test/t/func_time.test	2011-03-22 11:02:27 +0000
@@ -881,4 +881,12 @@ INSERT INTO t1 VALUES (''),('');
 SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11765216  58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION
+--echo #
+
+SET GLOBAL SQL_MODE='';
+DO  STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
+SET GLOBAL SQL_MODE=DEFAULT;
+
 --echo End of 5.1 tests

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	2010-11-12 10:12:15 +0000
+++ b/sql/item_timefunc.cc	2011-03-22 11:02:27 +0000
@@ -3293,6 +3293,7 @@ void Item_func_str_to_date::fix_length_a
 {
   maybe_null= 1;
   decimals=0;
+  cached_format_type= DATE_TIME;
   cached_field_type= MYSQL_TYPE_DATETIME;
   max_length= MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN;
   cached_timestamp_type= MYSQL_TIMESTAMP_NONE;


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110322110227-pnxl2257a4g8uh3b.bundle
Thread
bzr commit into mysql-5.1 branch (sergey.glukhov:3618) Bug#11765216Sergey Glukhov22 Mar
  • Re: bzr commit into mysql-5.1 branch (sergey.glukhov:3618) Bug#11765216Gleb Shchepa25 Mar