diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-04-30 17:36:41 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-04-30 17:36:41 +0200 |
commit | 23c6fb3e6231b8939331e2d9f157092f24ed8f4f (patch) | |
tree | ff0f65edbc442afcc3f3a3159753c8a2284d9c95 /sql/sql_lex.cc | |
parent | de8c9b538f7e77f18470ccfcacf723a9c2e31b38 (diff) | |
parent | 6a31aea5a1a50614af3a6591a085dc47061cdd0e (diff) | |
download | mariadb-git-23c6fb3e6231b8939331e2d9f157092f24ed8f4f.tar.gz |
Merge branch '5.5' into 10.1
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 27da1fc16fd..02c0df97cf3 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 @@ -1181,17 +1181,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; } } |