List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:August 2 2010 12:36pm
Subject:bzr commit into mysql-trunk-bugfixing branch (epotemkin:3162) Bug#55648
View as plain text  
#At file:///work/bzrroot/55648-bug-trunk-bugfixing/ based on revid:alik@stripped

 3162 Evgeny Potemkin	2010-08-02
      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.

    modified:
      mysql-test/r/func_group.result
      mysql-test/t/func_group.test
      sql/item.cc
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/func_group.result	2010-08-02 12:36:41 +0000
@@ -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

=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test	2009-11-24 15:26:13 +0000
+++ b/mysql-test/t/func_group.test	2010-08-02 12:36:41 +0000
@@ -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
+

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2010-07-20 19:30:10 +0000
+++ b/sql/item.cc	2010-08-02 12:36:41 +0000
@@ -7510,13 +7510,13 @@ String *Item_cache_datetime::val_str(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(&ltime, MYSQL_TIMESTAMP_TIME);
         ltime.second= time % 100;
         time/= 100;
         ltime.minute= time % 100;
         time/= 100;
-        ltime.hour= time % 100;
+        ltime.hour= time;
       }
       else
       {


Attachment: [text/bzr-bundle] bzr/epotemkin@mysql.com-20100802123641-5688c4c8z9roeyxr.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (epotemkin:3162) Bug#55648Evgeny Potemkin2 Aug