summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 21:16:22 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-05-05 21:16:22 +0300
commit7bcaa541aa1f298abf8e863566a19b3e9ec2f659 (patch)
tree066d58ad89536edf0e9a3de898506735c933381f /sql/sql_lex.cc
parent36b8ac2c0d763a3f96b254cb6e2cbdbc40dde22b (diff)
parent2c3c851d2cba73825f81cd06220138b15c17ae4d (diff)
downloadmariadb-git-7bcaa541aa1f298abf8e863566a19b3e9ec2f659.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 59990e11e71..12c3d0a153d 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
+/* 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
@@ -1795,17 +1795,27 @@ static inline uint int_token(const char *str,uint length)
*/
bool Lex_input_stream::consume_comment(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 (!eof())
{
c= yyGet();
- if (remaining_recursions_permitted > 0)
+ if (remaining_recursions_permitted == 1)
{
if ((c == '/') && (yyPeek() == '*'))
{
- yySkip(); // Eat asterisk
- consume_comment(remaining_recursions_permitted - 1);
+ yyUnput('('); // Replace nested "/*..." with "(*..."
+ yySkip(); // and skip "("
+
+ yySkip(); /* Eat asterisk */
+ if (consume_comment(0))
+ return true;
+
+ yyUnput(')'); // Replace "...*/" with "...*)"
+ yySkip(); // and skip ")"
continue;
}
}