Commit 8147199f authored by Evgeny Potemkin's avatar Evgeny Potemkin

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.
parent 75fd19ad
...@@ -1714,3 +1714,14 @@ NULL NULL NULL NULL NULL ...@@ -1714,3 +1714,14 @@ NULL NULL NULL NULL NULL
drop table t1; drop table t1;
# #
End of 5.1 tests 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
...@@ -1085,3 +1085,13 @@ drop table t1; ...@@ -1085,3 +1085,13 @@ drop table t1;
--echo # --echo #
--echo End of 5.1 tests --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
...@@ -7510,13 +7510,13 @@ String *Item_cache_datetime::val_str(String *str) ...@@ -7510,13 +7510,13 @@ String *Item_cache_datetime::val_str(String *str)
if (cached_field_type == MYSQL_TYPE_TIME) if (cached_field_type == MYSQL_TYPE_TIME)
{ {
ulonglong time= int_value; ulonglong time= int_value;
DBUG_ASSERT(time < TIME_MAX_VALUE); DBUG_ASSERT(time <= TIME_MAX_VALUE);
set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME); set_zero_time(&ltime, MYSQL_TIMESTAMP_TIME);
ltime.second= time % 100; ltime.second= time % 100;
time/= 100; time/= 100;
ltime.minute= time % 100; ltime.minute= time % 100;
time/= 100; time/= 100;
ltime.hour= time % 100; ltime.hour= time;
} }
else else
{ {
......
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