summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-07-24 11:06:08 +0200
committerunknown <msvensson@neptunus.(none)>2006-07-24 11:06:08 +0200
commit7b8285c9565b883e35b7acb1a63cd0eb83007f4a (patch)
tree4fbc7f14cb4c079fe02607f150fcbb7544644ab0 /sql-common
parent464cadc99dcfbeda1a814d4a090e10f76f090976 (diff)
parenta2df3e6365ebbedfe3e0eed6a76fb4d7dce5c762 (diff)
downloadmariadb-git-7b8285c9565b883e35b7acb1a63cd0eb83007f4a.tar.gz
Merge bk-internal:/home/bk/mysql-5.0-maint
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/my_time.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index c9d39260761..93bf23ed284 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -69,6 +69,7 @@ uint calc_days_in_year(uint year)
Here we assume that year and month is ok !
If month is 0 we allow any date. (This only happens if we allow zero
date parts in str_to_datetime())
+ Disallow dates with zero year and non-zero month and/or day.
RETURN
0 ok
@@ -85,7 +86,8 @@ static my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
(!(flags & TIME_INVALID_DATES) &&
ltime->month && ltime->day > days_in_month[ltime->month-1] &&
(ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
- ltime->day != 29)))
+ ltime->day != 29)) ||
+ (ltime->year == 0 && (ltime->month != 0 || ltime->day != 0)))
{
*was_cut= 2;
return TRUE;