Skip to content

Commit a7e2cd5

Browse files
committed
MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH
1 parent 457dc9d commit a7e2cd5

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

mysql-test/r/type_datetime.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,5 +1156,16 @@ ExtractValue('foo','bar') i MIN(d)
11561156
3 1976-12-14 13:21:07
11571157
DROP TABLE t1;
11581158
#
1159+
# MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH
1160+
#
1161+
SET SQL_MODE=DEFAULT;
1162+
CREATE OR REPLACE TABLE t1 (a CHAR(11));
1163+
CREATE OR REPLACE TABLE t2 (b DATETIME);
1164+
INSERT INTO t1 VALUES ('2010-02-19') ;
1165+
SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH';
1166+
INSERT INTO t2 SELECT * FROM t1;
1167+
DROP TABLE t1, t2;
1168+
SET SQL_MODE=DEFAULT;
1169+
#
11591170
# End of 10.1 tests
11601171
#

mysql-test/t/type_datetime.test

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,20 @@ INSERT INTO t1 VALUES (3,NULL),(3,'1976-12-14 13:21:07'),(NULL,'1981-09-24 01:04
710710
SELECT ExtractValue('foo','bar'), i, MIN(d) FROM t1 GROUP BY i;
711711
DROP TABLE t1;
712712

713+
--echo #
714+
--echo # MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH
715+
--echo #
716+
717+
SET SQL_MODE=DEFAULT;
718+
CREATE OR REPLACE TABLE t1 (a CHAR(11));
719+
CREATE OR REPLACE TABLE t2 (b DATETIME);
720+
INSERT INTO t1 VALUES ('2010-02-19') ;
721+
SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH';
722+
INSERT INTO t2 SELECT * FROM t1;
723+
DROP TABLE t1, t2;
724+
SET SQL_MODE=DEFAULT;
725+
726+
713727
--echo #
714728
--echo # End of 10.1 tests
715729
--echo #

sql-common/my_time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static int get_date_time_separator(uint *number_of_fields, ulonglong flags,
184184
do
185185
{
186186
s++;
187-
} while (my_isspace(&my_charset_latin1, *s));
187+
} while (s < end && my_isspace(&my_charset_latin1, *s));
188188
*str= s;
189189
return 0;
190190
}

0 commit comments

Comments
 (0)