summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-03-28 12:03:53 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-03-28 12:03:53 +0400
commitb1b17093c890d622e38db4667eb3bd24127251e5 (patch)
tree2f1fec80b8ea0c0e3d2211a995c5b85c7121a190
parent25a9c56d67716425932d179e88291a5df5b70f98 (diff)
parentd499851be03a2a20f7cb230d9b2d69e169aa81c8 (diff)
downloadmariadb-git-b1b17093c890d622e38db4667eb3bd24127251e5.tar.gz
5.1->5.5 merge
-rw-r--r--mysql-test/r/func_time.result6
-rw-r--r--mysql-test/t/func_time.test6
-rw-r--r--sql/item_timefunc.cc4
3 files changed, 14 insertions, 2 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 09b0af61ea5..819ee7f167f 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1347,6 +1347,12 @@ Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
DROP TABLE t1;
+#
+# 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
#
# Bug#57039: constant subtime expression returns incorrect result.
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 9488ad4265d..9368c620220 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -862,6 +862,12 @@ INSERT INTO t1 VALUES (''),('');
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
DROP TABLE t1;
+--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
--echo #
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 99467b7c3fc..c277e538999 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -315,8 +315,8 @@ static bool extract_date_time(DATE_TIME_FORMAT *format,
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)
{