summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-06-06 16:17:58 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-06-06 16:17:58 +0300
commit455c676792b9e86746afd9567cfef2b8abcff0fb (patch)
treee7595cefaa0afdcedf56e8168738706d0b83f841 /sql/item_timefunc.cc
parent8ae2bb6eaaa5e2bf99390e498e5efe3090eb1d46 (diff)
parentaf78e87de36f0c10ce009b2bd9c856642ef1ab99 (diff)
downloadmariadb-git-455c676792b9e86746afd9567cfef2b8abcff0fb.tar.gz
merged mysql-5.5->mysql-5.5-security
Diffstat (limited to 'sql/item_timefunc.cc')
-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 5f30787f015..b642e38d8c6 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1591,6 +1591,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;
}
@@ -2779,7 +2784,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)
@@ -2822,7 +2827,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)