1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug#41470: DATE_FORMAT() crashes the complete server with a valid date

Passing dubious "year zero" in non-zero date (not "0000-00-00") could
lead to negative value for year internally, while variable was unsigned.
This led to Really Bad Things further down the line.

Now doing calculations with signed type for year internally.
This commit is contained in:
Tatiana A. Nurnberg
2009-01-08 10:25:31 +01:00
parent 8d16eb71b3
commit 17bbe30cb0
3 changed files with 29 additions and 6 deletions

View File

@@ -593,3 +593,13 @@ select str_to_date('04/30/2004 ', '%m/%d/%Y ');
str_to_date('04/30/2004 ', '%m/%d/%Y ')
2004-04-30
"End of 4.1 tests"
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
valid_date
Sunday 01 January 0000
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
valid_date
Tuesday 28 February 0000
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
valid_date
Thursday 01 January 2009
"End of 5.0 tests"