From 2e8ca84e893617bf970235bb8145c9c79d805ee4 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 5 Oct 2007 12:08:38 +0200 Subject: Bug #31253: crash comparing datetime to double convert(, 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. --- sql/item.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/item.cc') 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(<ime, TIME_FUZZY_DATE)) { my_decimal_set_zero(decimal_value); + null_value= 1; // set NULL, stop processing return 0; } return date2my_decimal(<ime, decimal_value); -- cgit v1.2.1