diff options
-rw-r--r-- | mysql-test/r/parser.result | 9 | ||||
-rw-r--r-- | mysql-test/t/parser.test | 10 | ||||
-rw-r--r-- | sql/sql_lex.cc | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 25143f97d9a..9a14c0e324b 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -663,3 +663,12 @@ select 1<<!0, 1 << !0; select 0<!0, 0 < ! 0; 0<!0 0 < ! 0 1 1 +# +# MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*) +# +CREATE TABLE t1 (id INT); +CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1 +PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1 +DROP TABLE t1; diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index c6aa8927848..1e3458eafdf 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -770,3 +770,13 @@ select 2>!0, 2 > ! 0; select 0<=!0, 0 <= !0; select 1<<!0, 1 << !0; select 0<!0, 0 < ! 0; + +--echo # +--echo # MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*) +--echo # +CREATE TABLE t1 (id INT); +--error ER_PARSE_ERROR +CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\; +--error ER_PARSE_ERROR +PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\'; +DROP TABLE t1; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index ee0e09acbf9..2462f0fea17 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1074,7 +1074,7 @@ static int lex_one_token(YYSTYPE *yylval, THD *thd) state= (enum my_lex_states) state_map[c]; break; case MY_LEX_ESCAPE: - if (lip->yyGet() == 'N') + if (!lip->eof() && lip->yyGet() == 'N') { // Allow \N as shortcut for NULL yylval->lex_str.str=(char*) "\\N"; yylval->lex_str.length=2; |