Skip to content

Commit

Permalink
MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHA…
Browse files Browse the repository at this point in the history
…R_TO_FULL_LENGTH
  • Loading branch information
abarkov committed Aug 20, 2019
1 parent 457dc9d commit a7e2cd5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
11 changes: 11 additions & 0 deletions mysql-test/r/type_datetime.result
Original file line number Diff line number Diff line change
Expand Up @@ -1156,5 +1156,16 @@ ExtractValue('foo','bar') i MIN(d)
3 1976-12-14 13:21:07
DROP TABLE t1;
#
# MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH
#
SET SQL_MODE=DEFAULT;
CREATE OR REPLACE TABLE t1 (a CHAR(11));
CREATE OR REPLACE TABLE t2 (b DATETIME);
INSERT INTO t1 VALUES ('2010-02-19') ;
SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH';
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
SET SQL_MODE=DEFAULT;
#
# End of 10.1 tests
#
14 changes: 14 additions & 0 deletions mysql-test/t/type_datetime.test
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,20 @@ INSERT INTO t1 VALUES (3,NULL),(3,'1976-12-14 13:21:07'),(NULL,'1981-09-24 01:04
SELECT ExtractValue('foo','bar'), i, MIN(d) FROM t1 GROUP BY i;
DROP TABLE t1;

--echo #
--echo # MDEV-19034 ASAN unknown-crash in get_date_time_separator with PAD_CHAR_TO_FULL_LENGTH
--echo #

SET SQL_MODE=DEFAULT;
CREATE OR REPLACE TABLE t1 (a CHAR(11));
CREATE OR REPLACE TABLE t2 (b DATETIME);
INSERT INTO t1 VALUES ('2010-02-19') ;
SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH';
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
SET SQL_MODE=DEFAULT;


--echo #
--echo # End of 10.1 tests
--echo #
2 changes: 1 addition & 1 deletion sql-common/my_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ static int get_date_time_separator(uint *number_of_fields, ulonglong flags,
do
{
s++;
} while (my_isspace(&my_charset_latin1, *s));
} while (s < end && my_isspace(&my_charset_latin1, *s));
*str= s;
return 0;
}
Expand Down

0 comments on commit a7e2cd5

Please sign in to comment.