summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorOystein Grovlen <oystein.grovlen@oracle.com>2010-10-20 15:17:29 +0200
committerOystein Grovlen <oystein.grovlen@oracle.com>2010-10-20 15:17:29 +0200
commit7a8515cc200bc867bb1d0f24bc8b51ea237ef8dd (patch)
tree4d56cdeb1c0979014f6cbdb0fa60f83dc2ba8adf /sql/item_timefunc.cc
parent6ce340789a4786f2d6f02ee08b4e591f530bedf6 (diff)
downloadmariadb-git-7a8515cc200bc867bb1d0f24bc8b51ea237ef8dd.tar.gz
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.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 49336b04e16..3771706fb63 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -3465,7 +3465,7 @@ bool Item_func_str_to_date::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return 0;
null_date:
- if (fuzzy_date & TIME_NO_ZERO_DATE)
+ if (val && (fuzzy_date & TIME_NO_ZERO_DATE))
{
char buff[128];
strmake(buff, val->ptr(), min(val->length(), sizeof(buff)-1));