Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-05 12:08:38+02:00, tnurnberg@stripped +3 -0
Bug #31253: crash comparing datetime to double
convert(<invalid time>, datetime) in WHERE caused crash as function
returned (void*)NULL, but did not flag SQL NULL. It does now.
mysql-test/r/type_datetime.result@stripped, 2007-10-05 12:08:36+02:00, tnurnberg@stripped +9 -0
show that convert() to datetime in a WHERE-clause will no longer crash
the server on invalid input.
mysql-test/t/type_datetime.test@stripped, 2007-10-05 12:08:36+02:00, tnurnberg@stripped +10 -0
show that convert() to datetime in a WHERE-clause will no longer crash
the server on invalid input.
sql/item.cc@stripped, 2007-10-05 12:08:36+02:00, tnurnberg@stripped +1 -0
When failing to process time values, do not just return (void*)NULL,
but flag SQL NULL as well so no caller will try to process the 0x0L.
This makes behaviour for Item::Item::val_decimal_from_date() and
Item::Item::val_decimal_from_time() identical.
diff -Nrup a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
--- a/mysql-test/r/type_datetime.result 2007-06-05 22:25:01 +02:00
+++ b/mysql-test/r/type_datetime.result 2007-10-05 12:08:36 +02:00
@@ -427,3 +427,12 @@ f1
Warnings:
Warning 1292 Incorrect datetime value: '2007010100000' for column 'f1' at row 1
drop table t1;
+create table t1 (f1 time);
+insert into t1 set f1 = '45:44:44';
+insert into t1 set f1 = '15:44:44';
+select * from t1 where (convert(f1,datetime)) != 1;
+f1
+15:44:44
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '0000-00-00 45:44:44'
+drop table t1;
diff -Nrup a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
--- a/mysql-test/t/type_datetime.test 2007-06-05 22:25:02 +02:00
+++ b/mysql-test/t/type_datetime.test 2007-10-05 12:08:36 +02:00
@@ -282,3 +282,13 @@ select * from t1 where f1 between 200201
select * from t1 where f1 between 2002010 and 20070101000000;
select * from t1 where f1 between 20020101 and 2007010100000;
drop table t1;
+
+#
+# Bug #31253: crash comparing datetime to double
+# Should return 1st row only. Crashes if NULL propagation fails.
+#
+create table t1 (f1 time);
+insert into t1 set f1 = '45:44:44';
+insert into t1 set f1 = '15:44:44';
+select * from t1 where (convert(f1,datetime)) != 1;
+drop table t1;
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc 2007-09-13 15:30:28 +02:00
+++ b/sql/item.cc 2007-10-05 12:08:36 +02:00
@@ -274,6 +274,7 @@ my_decimal *Item::val_decimal_from_date(
if (get_date(<ime, TIME_FUZZY_DATE))
{
my_decimal_set_zero(decimal_value);
+ null_value= 1; // set NULL, stop processing
return 0;
}
return date2my_decimal(<ime, decimal_value);
| Thread |
|---|
| • bk commit into 5.0 tree (tnurnberg:1.2526) BUG#31253 | Tatjana A Nuernberg | 5 Oct |