summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2013-06-28 12:00:25 +0400
committerAlexander Barkov <bar@mariadb.org>2013-06-28 12:00:25 +0400
commit0e44faf27ff243f8e8c1432568eef21964ad326c (patch)
tree791c8b48054d1ce7387b9687ed3b91a1c43c5a69 /sql/item_func.cc
parent4085836acf1b70738efe6d33a51e8d2ab9deb63f (diff)
downloadmariadb-git-0e44faf27ff243f8e8c1432568eef21964ad326c.tar.gz
MDEV-4634 Crash in CONVERT_TZ
Item_func_min_max::get_date() did not check the returned value against the fuzzy_date flags, so it could return a bad value to the caller that expects a good date (e.h. CONVERT_TZ). modified: mysql-test/r/type_date.result mysql-test/r/type_datetime.result mysql-test/r/type_time.result mysql-test/t/type_date.test mysql-test/t/type_datetime.test mysql-test/t/type_time.test sql/item_func.cc sql/item_timefunc.cc sql/mysql_priv.h sql/time.cc
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 2d99ceff0d3..ccbdabe0a90 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2469,6 +2469,12 @@ bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
min_max= res;
}
unpack_time(min_max, ltime);
+
+ if (!(fuzzy_date & TIME_TIME_ONLY) &&
+ ((null_value= check_date_with_warn(ltime, fuzzy_date,
+ MYSQL_TIMESTAMP_ERROR))))
+ return true;
+
if (compare_as_dates->field_type() == MYSQL_TYPE_DATE)
{
ltime->time_type= MYSQL_TIMESTAMP_DATE;