1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-4634 Crash in CONVERT_TZ

Item_func_min_max::get_date() did not check the
returned value against the fuzzy_date flags, so
it could return a bad value to the caller that
expects a good date (e.h. CONVERT_TZ).


modified:
  mysql-test/r/type_date.result
  mysql-test/r/type_datetime.result
  mysql-test/r/type_time.result
  mysql-test/t/type_date.test
  mysql-test/t/type_datetime.test
  mysql-test/t/type_time.test
  sql/item_func.cc
  sql/item_timefunc.cc
  sql/mysql_priv.h
  sql/time.cc
This commit is contained in:
Alexander Barkov
2013-06-28 12:00:25 +04:00
parent 4085836acf
commit 0e44faf27f
10 changed files with 77 additions and 10 deletions

View File

@ -298,3 +298,14 @@ insert t1 values ('2010-10-10 15:foobar');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
drop table t1;
#
# MDEV-4634 Crash in CONVERT_TZ
#
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2022-00-00 00:00:00'
#
# End of 5.3 tests
#

View File

@ -681,4 +681,12 @@ c a b
1 1 0000-00-00
3 NULL NULL
drop table t1,t2;
#
# MDEV-4634 Crash in CONVERT_TZ
#
SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '2022-00-00 00:00:00'
End of 5.3 tests

View File

@ -173,3 +173,14 @@ select f1, f1 = '2010-10-11 23:38:57' from t1;
f1 f1 = '2010-10-11 23:38:57'
23:38:57 0
drop table t1;
#
# MDEV-4634 Crash in CONVERT_TZ
#
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5')
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00'
#
# End of 5.3 tests
#

View File

@ -282,3 +282,11 @@ create table t1 (f1 date, key (f1));
insert t1 values ('2010-10-10 15:foobar');
drop table t1;
--echo #
--echo # MDEV-4634 Crash in CONVERT_TZ
--echo #
SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
--echo #
--echo # End of 5.3 tests
--echo #

View File

@ -486,5 +486,10 @@ select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
drop table t1,t2;
--echo #
--echo # MDEV-4634 Crash in CONVERT_TZ
--echo #
SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5');
--echo End of 5.3 tests

View File

@ -123,3 +123,11 @@ insert into t1 values ('23:38:57');
select f1, f1 = '2010-10-11 23:38:57' from t1;
drop table t1;
--echo #
--echo # MDEV-4634 Crash in CONVERT_TZ
--echo #
SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
--echo #
--echo # End of 5.3 tests
--echo #