diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-04-02 11:40:22 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-04-02 11:40:22 +0400 |
commit | ea5cda5269e08ca1560f18fbe24d8dfa980808b1 (patch) | |
tree | 97f414fb2c854718d64efca0f6bd3cc86e628f0c | |
parent | b9ea778f6cc5f1e5c77b330c7f801622f87f2a31 (diff) | |
download | mariadb-git-ea5cda5269e08ca1560f18fbe24d8dfa980808b1.tar.gz |
MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_date
-rw-r--r-- | mysql-test/main/func_time.result | 9 | ||||
-rw-r--r-- | mysql-test/main/func_time.test | 8 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index e5e9610da8c..8546a7bc84b 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6336,3 +6336,12 @@ Warnings: Warning 1292 Truncated incorrect DECIMAL value: 'foo' Warning 1292 Truncated incorrect DECIMAL value: 'foo' SET time_zone=DEFAULT; +# +# MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_date +# +SELECT MAKETIME('01', '01', LEAST( -100, NULL )); +MAKETIME('01', '01', LEAST( -100, NULL )) +NULL +SELECT CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))); +CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))) +NULL diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index 212df328130..5760553e0dd 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -3162,3 +3162,11 @@ SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); SET time_zone='+00:00'; SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); SET time_zone=DEFAULT; + + +--echo # +--echo # MDEV-18402 Assertion `sec.sec() <= 59' failed in Item_func_maketime::get_date +--echo # + +SELECT MAKETIME('01', '01', LEAST( -100, NULL )); +SELECT CONCAT(MAKETIME('01', '01', LEAST( -100, NULL ))); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index b8fd15bb5bf..2627d5413a2 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2595,7 +2595,7 @@ bool Item_func_maketime::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzy longlong minute= args[1]->val_int(); VSec9 sec(thd, args[2], "seconds", 59); - DBUG_ASSERT(sec.sec() <= 59); + DBUG_ASSERT(sec.is_null() || sec.sec() <= 59); if (args[0]->null_value || args[1]->null_value || sec.is_null() || minute < 0 || minute > 59 || sec.neg() || sec.truncated()) return (null_value= 1); |