summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <tnurnberg@sin.intern.azundris.com>2007-10-05 12:08:38 +0200
committerunknown <tnurnberg@sin.intern.azundris.com>2007-10-05 12:08:38 +0200
commit2e8ca84e893617bf970235bb8145c9c79d805ee4 (patch)
tree8ec861da17dc4d95f3a30f9828e82d3a19b9a1bb /sql/item.cc
parentba0cd51eb19f1f8868901d4b2327e1c8f4745c19 (diff)
downloadmariadb-git-2e8ca84e893617bf970235bb8145c9c79d805ee4.tar.gz
Bug #31253: crash comparing datetime to double
convert(<invalid time>, datetime) in WHERE caused crash as function returned (void*)NULL, but did not flag SQL NULL. It does now. mysql-test/r/type_datetime.result: show that convert() to datetime in a WHERE-clause will no longer crash the server on invalid input. mysql-test/t/type_datetime.test: show that convert() to datetime in a WHERE-clause will no longer crash the server on invalid input. sql/item.cc: When failing to process time values, do not just return (void*)NULL, but flag SQL NULL as well so no caller will try to process the 0x0L. This makes behaviour for Item::Item::val_decimal_from_date() and Item::Item::val_decimal_from_time() identical.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc
index e9b2904e3da..5f73b016e50 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -274,6 +274,7 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
if (get_date(&ltime, TIME_FUZZY_DATE))
{
my_decimal_set_zero(decimal_value);
+ null_value= 1; // set NULL, stop processing
return 0;
}
return date2my_decimal(&ltime, decimal_value);