1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +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

@@ -337,3 +337,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y');
select str_to_date('04/30/2004 ', '%m/%d/%Y ');
--echo "End of 4.1 tests"
#
# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date
#
# show that these two do not crash the server:
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
# show that date within the Gregorian range render correct results: (THU)
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
--echo "End of 5.0 tests"