1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug#57512 str_to_date crash...

str_to_date function should only try to generate a warning for
invalid input strings, not when input value is NULL. In latter
case, val_str() of input argument will return a nil pointer.
Trying to generate a warning using this pointer lead to a
segmentation fault. Solution: Only generate warning when pointer
to input string is non-nil.


mysql-test/r/func_time.result:
  Added test case for Bug#57512
mysql-test/t/func_time.test:
  Added test case for Bug#57512
sql/item_timefunc.cc:
  Skip generating warning when pointer to input string is nil
  since this implies that input argument was NULL.
This commit is contained in:
Oystein Grovlen
2010-10-20 15:17:29 +02:00
parent 6ce340789a
commit 7a8515cc20
3 changed files with 18 additions and 1 deletions

View File

@@ -1327,3 +1327,12 @@ SELECT * FROM t1 WHERE date_date <= addtime(date_add("2000-1-1", INTERVAL "1:1:1
date_date
DROP TABLE t1;
#
# Bug#57512 str_to_date crash...
#
SELECT WEEK(STR_TO_DATE(NULL,0));
WEEK(STR_TO_DATE(NULL,0))
NULL
SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR);
SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR)
NULL
#