diff options
author | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2006-11-09 16:17:50 +0400 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/myoffice.izhnet.ru> | 2006-11-09 16:17:50 +0400 |
commit | 69d8bfe2319f313ab31f92a450890a870b630fe7 (patch) | |
tree | 54338f4d7c09cc993c7df976103b54a61c41d7ce /sql/item_timefunc.cc | |
parent | 870b2e0a2b4a66c6b4b4f15792d72a7415190650 (diff) | |
download | mariadb-git-69d8bfe2319f313ab31f92a450890a870b630fe7.tar.gz |
Fix for bug #23653: Crash if last_day('0000-00-00')
As get_arg0_date() in the Item_func_last_day::get_date() returns
0000-00-00 date sometimes, we have to check ltime->month for 0 after the call.
mysql-test/r/func_time.result:
Fix for bug #23653: Crash if last_day('0000-00-00')
- test result.
mysql-test/t/func_time.test:
Fix for bug #23653: Crash if last_day('0000-00-00')
- test case.
sql/item_timefunc.cc:
Fix for bug #23653: Crash if last_day('0000-00-00')
- return error if month is 0.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index c1bca7afc60..ec424910f54 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -3058,7 +3058,8 @@ String *Item_func_str_to_date::val_str(String *str) bool Item_func_last_day::get_date(TIME *ltime, uint fuzzy_date) { - if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE)) + if (get_arg0_date(ltime, fuzzy_date & ~TIME_FUZZY_DATE) || + (ltime->month == 0)) return 1; uint month_idx= ltime->month-1; ltime->day= days_in_month[month_idx]; |