summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <sergey.glukhov@oracle.com>2011-05-18 10:47:43 +0400
committerSergey Glukhov <sergey.glukhov@oracle.com>2011-05-18 10:47:43 +0400
commita7cd008e12875d21d37ae92ccbef50d87d4fbd35 (patch)
treeeebaafb8047e0cec9db554e2a619116ed5ad01a1 /sql
parent473173632021092d09c8955b2d260cb9a0c5fa5e (diff)
downloadmariadb-git-a7cd008e12875d21d37ae92ccbef50d87d4fbd35.tar.gz
Bug#12403504 AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
There are two problems: 1. There is a missing check for 'year' parameter(year can not be greater than 9999) in makedate function. fix: added check that year can not be greater than 9999. 2. There is a missing check for zero date in from_days() function. fix: added zero date check into Item_func_from_days::get_date() function.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_timefunc.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index a96922b94a1..9b312247017 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1519,6 +1519,11 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
return 1;
bzero(ltime, sizeof(MYSQL_TIME));
get_date_from_daynr((long) value, &ltime->year, &ltime->month, &ltime->day);
+
+ if ((null_value= (fuzzy_date & TIME_NO_ZERO_DATE) &&
+ (ltime->year == 0 || ltime->month == 0 || ltime->day == 0)))
+ return TRUE;
+
ltime->time_type= MYSQL_TIMESTAMP_DATE;
return 0;
}
@@ -2697,7 +2702,7 @@ String *Item_func_makedate::val_str(String *str)
long days;
if (args[0]->null_value || args[1]->null_value ||
- year < 0 || daynr <= 0)
+ year < 0 || year > 9999 || daynr <= 0)
goto err;
if (year < 100)
@@ -2740,7 +2745,7 @@ longlong Item_func_makedate::val_int()
long days;
if (args[0]->null_value || args[1]->null_value ||
- year < 0 || daynr <= 0)
+ year < 0 || year > 9999 || daynr <= 0)
goto err;
if (year < 100)