Commit 4299b82a authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17015 Assertion `m_year <= 9999' failed in Year::Year upon bad argument to MAKEDATE

parent bf1c53e9
......@@ -554,5 +554,11 @@ MIN(a) MAX(a)
70 69
DROP TABLE t1;
#
# MDEV-17015 Assertion `m_year <= 9999' failed in Year::Year upon bad argument to MAKEDATE
#
SELECT MAKEDATE(18446744073709551615, 1);
MAKEDATE(18446744073709551615, 1)
NULL
#
# End of 10.4 tests
#
......@@ -294,6 +294,10 @@ SELECT a, CAST(a AS DATE), CAST(COALESCE(a) AS DATE) FROM t1;
SELECT MIN(a), MAX(a) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-17015 Assertion `m_year <= 9999' failed in Year::Year upon bad argument to MAKEDATE
--echo #
SELECT MAKEDATE(18446744073709551615, 1);
--echo #
--echo # End of 10.4 tests
......
......@@ -323,8 +323,8 @@ VSec6::VSec6(Item *item, const char *type_str, ulonglong limit)
Year::Year(longlong value, bool unsigned_flag, uint length)
{
if ((m_truncated= (value < 0 && !unsigned_flag)))
m_year= 0;
if ((m_truncated= (value < 0))) // Negative or huge unsigned
m_year= unsigned_flag ? 9999 : 0;
else if (value > 9999)
{
m_truncated= true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment