mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted
Reject '0000-00-00 01:01:01' dates. mysql-test/r/date_formats.result: Fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted - test results adjusted. sql-common/my_time.c: Fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted - don't allow dates with NULL date part and not NULL time part.
This commit is contained in:
@@ -350,7 +350,10 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
|
||||
l_time->year > 9999 || l_time->month > 12 ||
|
||||
l_time->day > 31 || l_time->hour > 23 ||
|
||||
l_time->minute > 59 || l_time->second > 59 ||
|
||||
(!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 || l_time->day == 0)))
|
||||
(!(flags & TIME_FUZZY_DATE) &&
|
||||
(l_time->month == 0 || l_time->day == 0)) ||
|
||||
(l_time->year == 0 && l_time->month == 0 && l_time->day == 0 &&
|
||||
(l_time->hour != 0 || l_time->minute != 0 || l_time->second != 0)))
|
||||
{
|
||||
/* Only give warning for a zero date if there is some garbage after */
|
||||
if (!not_zero_date) /* If zero date */
|
||||
|
||||
Reference in New Issue
Block a user