#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:georgi.kodinov@stripped
3638 Sergey Glukhov 2011-03-28
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-03-28 07:53:18 +0000
+++ b/mysql-test/r/func_time.result 2011-03-28 13:24:25 +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#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-03-28 07:53:18 +0000
+++ b/mysql-test/t/func_time.test 2011-03-28 13:24:25 +0000
@@ -887,4 +887,12 @@ DROP TABLE t1;
SELECT STR_TO_DATE(SPACE(2),'1');
+--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 2011-03-28 07:53:18 +0000
+++ b/sql/item_timefunc.cc 2011-03-28 13:24:25 +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-20110328132425-7p6fs1054l45i54i.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (sergey.glukhov:3638) Bug#11765216 | Sergey Glukhov | 28 Mar |