From c2509a1588ee1dc7351b67b2f9149003540015c4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 10 Oct 2017 10:35:12 +0400 Subject: MDEV-13972 crash in Item_func_sec_to_time::get_date --- sql/item_timefunc.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sql/item_timefunc.cc') diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 0ed1506bbee..eeb373a75ee 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1733,9 +1733,18 @@ overflow: ltime->hour= TIME_MAX_HOUR+1; check_time_range(ltime, decimals, &unused); - make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - err->ptr(), err->length(), - MYSQL_TIMESTAMP_TIME, NullS); + if (!err) + { + ErrConvInteger err2(sec, unsigned_flag); + make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } + else + { + ErrConvString err2(err); + make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + &err2, MYSQL_TIMESTAMP_TIME, NullS); + } return 0; } -- cgit v1.2.1