#At file:///home/gluh/MySQL/mysql-5.1/ based on revid:sergey.glukhov@stripped
3619 Sergey Glukhov 2011-03-23
Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
Valgrind warining happens due to missing
'end of the string' check. The fix is to
check if we reached the end of the string
after leading spaces skipping.
@ mysql-test/r/func_time.result
test case
@ mysql-test/t/func_time.test
test case
@ sql/item_timefunc.cc
check if we reached the end of
the string after leading spaces skipping.
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-22 11:02:27 +0000
+++ b/mysql-test/r/func_time.result 2011-03-23 09:34:26 +0000
@@ -1381,4 +1381,10 @@ DROP TABLE t1;
SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
+#
+# Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
+#
+SELECT STR_TO_DATE(SPACE(2),'1');
+STR_TO_DATE(SPACE(2),'1')
+0000-00-00
End of 5.1 tests
=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test 2011-03-22 11:02:27 +0000
+++ b/mysql-test/t/func_time.test 2011-03-23 09:34:26 +0000
@@ -889,4 +889,10 @@ SET GLOBAL SQL_MODE='';
DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE));
SET GLOBAL SQL_MODE=DEFAULT;
+--echo #
+--echo # Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ...
+--echo #
+
+SELECT STR_TO_DATE(SPACE(2),'1');
+
--echo End of 5.1 tests
=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc 2011-03-22 11:02:27 +0000
+++ b/sql/item_timefunc.cc 2011-03-23 09:34:26 +0000
@@ -294,8 +294,8 @@ static bool extract_date_time(DATE_TIME_
for (; ptr != end && val != val_end; ptr++)
{
/* Skip pre-space between each argument */
- while (val != val_end && my_isspace(cs, *val))
- val++;
+ if ((val+= cs->cset->scan(cs, val, val_end, MY_SEQ_SPACES)) >= val_end)
+ break;
if (*ptr == '%' && ptr+1 != end)
{
Attachment: [text/bzr-bundle] bzr/sergey.glukhov@oracle.com-20110323093426-kz59ituzrsn1mk9k.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (sergey.glukhov:3619) Bug#11766112 | Sergey Glukhov | 23 Mar |