diff options
author | Evgeny Potemkin <epotemkin@mysql.com> | 2010-08-02 16:36:41 +0400 |
---|---|---|
committer | Evgeny Potemkin <epotemkin@mysql.com> | 2010-08-02 16:36:41 +0400 |
commit | 8147199f62a0793f2b0936d086960aa1a9fc57fc (patch) | |
tree | fb63b192ee76712bb5660bbd3b2d8ee3914049e9 | |
parent | 75fd19ad0d2a6e6b9e813ceb1c6d5a282554abe9 (diff) | |
download | mariadb-git-8147199f62a0793f2b0936d086960aa1a9fc57fc.tar.gz |
Bug#55648: Server crash on MIX/MAX on maximum time value
A typo in the Item_cache_datetime::val_str caused an assertion to fail on the
maximum time value.
mysql-test/r/func_group.result:
A test case for the bug#55648.
mysql-test/t/func_group.test:
A test case for the bug#55648.
sql/item.cc:
Bug#55648: Server crash on MIX/MAX on maximum time value
Corrected assertion.
-rw-r--r-- | mysql-test/r/func_group.result | 11 | ||||
-rw-r--r-- | mysql-test/t/func_group.test | 10 | ||||
-rw-r--r-- | sql/item.cc | 4 |
3 files changed, 23 insertions, 2 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 6838dcf944c..45c93971852 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -1714,3 +1714,14 @@ NULL NULL NULL NULL NULL drop table t1; # End of 5.1 tests +# +# Bug#55648: Server crash on MIX/MAX on maximum time value +# +CREATE TABLE t1(c1 TIME NOT NULL); +INSERT INTO t1 VALUES('837:59:59'); +INSERT INTO t1 VALUES('838:59:59'); +SELECT MAX(c1) FROM t1; +MAX(c1) +838:59:59 +DROP TABLE t1; +# End of the bug#55648 diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 6dbc8a05789..2914bb15d18 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1085,3 +1085,13 @@ drop table t1; --echo # --echo End of 5.1 tests +--echo # +--echo # Bug#55648: Server crash on MIX/MAX on maximum time value +--echo # +CREATE TABLE t1(c1 TIME NOT NULL); +INSERT INTO t1 VALUES('837:59:59'); +INSERT INTO t1 VALUES('838:59:59'); +SELECT MAX(c1) FROM t1; +DROP TABLE t1; +--echo # End of the bug#55648 + diff --git a/sql/item.cc b/sql/item.cc index 8210f4e6caf..1decb5ec426 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7510,13 +7510,13 @@ String *Item_cache_datetime::val_str(String *str) if (cached_field_type == MYSQL_TYPE_TIME) { ulonglong time= int_value; - DBUG_ASSERT(time < TIME_MAX_VALUE); + DBUG_ASSERT(time <= TIME_MAX_VALUE); set_zero_time(<ime, MYSQL_TIMESTAMP_TIME); ltime.second= time % 100; time/= 100; ltime.minute= time % 100; time/= 100; - ltime.hour= time % 100; + ltime.hour= time; } else { |