diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-05-02 08:44:17 +0200 |
commit | ca091e6372c4d1b05d2338e878042c2914519a4e (patch) | |
tree | 406c71091eb4fdf4409147d22e6749309f677e8e /sql/sql_lex.cc | |
parent | 28325b08633372cc343dfcbc41fe252020cf6e6e (diff) | |
parent | d233fd14a39f9c583b85ffb03e42b5ea52e2f4c2 (diff) | |
download | mariadb-git-ca091e6372c4d1b05d2338e878042c2914519a4e.tar.gz |
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b0d43358b6e..2312ec34e7b 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB Corporation +/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2020, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1190,17 +1190,27 @@ static inline uint int_token(const char *str,uint length) */ bool consume_comment(Lex_input_stream *lip, int remaining_recursions_permitted) { + // only one level of nested comments are allowed + DBUG_ASSERT(remaining_recursions_permitted == 0 || + remaining_recursions_permitted == 1); uchar c; while (! lip->eof()) { c= lip->yyGet(); - if (remaining_recursions_permitted > 0) + if (remaining_recursions_permitted == 1) { if ((c == '/') && (lip->yyPeek() == '*')) { + lip->yyUnput('('); // Replace nested "/*..." with "(*..." + lip->yySkip(); // and skip "(" + lip->yySkip(); /* Eat asterisk */ - consume_comment(lip, remaining_recursions_permitted-1); + if (consume_comment(lip, 0)) + return true; + + lip->yyUnput(')'); // Replace "...*/" with "...*)" + lip->yySkip(); // and skip ")" continue; } } |