Commit 75ceb6ff authored by Alexander Barkov's avatar Alexander Barkov

MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT

parent 09e97299
...@@ -7963,5 +7963,14 @@ ABCDEFGHI-ABCDEFGHI ...@@ -7963,5 +7963,14 @@ ABCDEFGHI-ABCDEFGHI
DROP TABLE t1; DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch; SET optimizer_switch=@save_optimizer_switch;
# #
# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
#
SET NAMES latin1;
CREATE TABLE t1 (a CHAR);
CREATE TABLE t2 (b ENUM('foo','bar'));
INSERT INTO t1 VALUES ('1');
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
#
# End of 10.0 tests # End of 10.0 tests
# #
...@@ -264,6 +264,18 @@ SET NAMES latin1; ...@@ -264,6 +264,18 @@ SET NAMES latin1;
--source include/ctype_mdev13118.inc --source include/ctype_mdev13118.inc
--echo #
--echo # MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT
--echo #
SET NAMES latin1;
CREATE TABLE t1 (a CHAR);
CREATE TABLE t2 (b ENUM('foo','bar'));
INSERT INTO t1 VALUES ('1');
INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
--echo # --echo #
--echo # End of 10.0 tests --echo # End of 10.0 tests
--echo # --echo #
...@@ -454,7 +454,6 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -454,7 +454,6 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
register uint cutlim; register uint cutlim;
register uint32 i; register uint32 i;
register const char *s; register const char *s;
register uchar c;
const char *save, *e; const char *save, *e;
int overflow; int overflow;
...@@ -489,8 +488,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs, ...@@ -489,8 +488,9 @@ ulong my_strntoul_8bit(CHARSET_INFO *cs,
overflow = 0; overflow = 0;
i = 0; i = 0;
for (c = *s; s != e; c = *++s) for ( ; s != e; ++s)
{ {
register uchar c= *s;
if (c>='0' && c<='9') if (c>='0' && c<='9')
c -= '0'; c -= '0';
else if (c>='A' && c<='Z') else if (c>='A' && c<='Z')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment