List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:November 16 2011 2:59pm
Subject:bzr push into mysql-trunk branch (alexander.barkov:3563 to 3564) Bug#13365131
View as plain text  
 3564 Alexander Barkov	2011-11-16
      Bug#13365131 - VALGRIND: CONDITIONAL JUMP OR MOVE DEPENDS ON UNINITIALISED IN MY_TIME_COMPARE

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item.cc
 3563 Alexander Barkov	2011-11-16
      WL#946: Bug#13392141 ASSERT FAILURE IN SEC_SINCE_EPOCH

    modified:
      mysql-test/r/type_temporal_fractional.result
      mysql-test/t/type_temporal_fractional.test
      sql/item_func.cc
      sql/item_timefunc.cc
      sql/item_timefunc.h
=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-11-16 13:45:51 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-11-16 14:58:34 +0000
@@ -16617,3 +16617,30 @@ Warning	1292	Truncated incorrect date va
 Warning	1292	Truncated incorrect date value: '17:28:30'
 DROP TABLE t1;
 SET timestamp=DEFAULT;
+#
+# Bug#13365131 - VALGRIND: CONDITIONAL JUMP OR MOVE DEPENDS ON UNINITIALISED IN MY_TIME_COMPARE
+#
+CREATE TABLE t1 (
+col_time_not_null_key time not null,
+col_timestamp_6_not_null_key timestamp(6) not null NULL DEFAULT 0,
+col_datetime_6_not_null_key datetime(6) not null,
+col_datetime_6_key datetime(6),
+col_time_3_not_null_key time(3) not null,
+col_datetime_3_key  datetime(3),
+key (col_datetime_6_not_null_key),
+key (col_datetime_3_key)) ENGINE=innodb;
+CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+SELECT col_datetime_3_key AS c1 FROM v1
+WHERE SYSDATE() IS NULL
+OR col_datetime_6_not_null_key < TIMEDIFF('0000-00-00','2002-11-24' )
+AND col_timestamp_6_not_null_key IS NULL;
+c1
+Warnings:
+Warning	1292	Truncated incorrect time value: '0000-00-00'
+Warning	1292	Truncated incorrect time value: '2002-11-24'
+Warning	1292	Truncated incorrect time value: '0000-00-00'
+Warning	1292	Truncated incorrect time value: '2002-11-24'
+Warning	1292	Truncated incorrect time value: '0000-00-00'
+Warning	1292	Truncated incorrect time value: '2002-11-24'
+DROP VIEW v1;
+DROP TABLE t1;

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-11-16 13:45:51 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-11-16 14:58:34 +0000
@@ -7199,6 +7199,27 @@ WHERE CONVERT_TZ(GREATEST('2005-11-05 18
 DROP TABLE t1;
 SET timestamp=DEFAULT;
 
+--echo #
+--echo # Bug#13365131 - VALGRIND: CONDITIONAL JUMP OR MOVE DEPENDS ON UNINITIALISED IN MY_TIME_COMPARE
+--echo #
+CREATE TABLE t1 (
+  col_time_not_null_key time not null,
+  col_timestamp_6_not_null_key timestamp(6) not null NULL DEFAULT 0,
+  col_datetime_6_not_null_key datetime(6) not null,
+  col_datetime_6_key datetime(6),
+  col_time_3_not_null_key time(3) not null,
+  col_datetime_3_key  datetime(3),
+key (col_datetime_6_not_null_key),
+key (col_datetime_3_key)) ENGINE=innodb;
+CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+SELECT col_datetime_3_key AS c1 FROM v1
+WHERE SYSDATE() IS NULL
+OR col_datetime_6_not_null_key < TIMEDIFF('0000-00-00','2002-11-24' )
+AND col_timestamp_6_not_null_key IS NULL;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
 ## TS-TODO: SELECT CAST('00:00:00' AS DATETIME) -> should it use curdate?
 
 ## TS-TODO: reuse count_datetime_length()/count_string_result_length()

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-11-15 13:06:17 +0000
+++ b/sql/item.cc	2011-11-16 14:58:34 +0000
@@ -8136,14 +8136,19 @@ int stored_field_cmp_to_item(THD *thd, F
   if (field->type() == MYSQL_TYPE_TIME &&
       item->field_type() == MYSQL_TYPE_TIME)
   {
-    /* Field_time[f] and Item_time_with_ref */
     longlong field_value= field->val_time_temporal();
     longlong item_value= item->val_time_temporal();
     return field_value < item_value ? -1 : field_value > item_value ? 1 : 0;
   }
-  if (field->is_temporal_with_date() && item->is_temporal_with_date())
+  if (field->is_temporal_with_date() && item->is_temporal())
   {
-    /* Field_newdate/datetime[f]/timestamp[f] and Item_datetime_with_ref */
+    /*
+      Note, in case of TIME data type we also go here
+      and call item->val_date_temporal(), because we want
+      TIME to be converted to DATE/DATETIME properly.
+      Only non-temporal data types go though get_mysql_time_from_str()
+      in the below code branch.
+    */
     longlong field_value= field->val_date_temporal();
     longlong item_value= item->val_date_temporal();
     return field_value < item_value ? -1 : field_value > item_value ? 1 : 0;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3563 to 3564) Bug#13365131Alexander Barkov18 Nov