diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-07-15 14:04:00 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@digia.com> | 2014-07-22 15:45:02 +0200 |
commit | 5d45e0b69a1ce53d4456a2741acd348a8bb244c3 (patch) | |
tree | 8fd5c4f68dd9a3bb7952bc1828cb01aad1f543d4 /src/libs/3rdparty/cplusplus/Parser.h | |
parent | f51553b2287661f115e46ee2f01f085995e1332a (diff) |
C++: block recursion when parsing subsequent case statements.
A case or a default statement must be followed by another statement.
When a such a case (or default) statement is followed immediately by
another case (or default) statement, then this would create a linked
list, and the parser will recurse to parse such input.
In order to prevent the parser running out of stack space while
recursing, parse this corner case by blocking parsing a labeled
statement as the first statement after a labeled statement.
The advantage is that these statements do not form a linked list, so any
subsequent visitation of the AST won't run out of stack space either.
Change-Id: Id2111a49509132997f5fbe4bb12c92c729ec2522
Task-number: QTCREATORBUG-12673
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Parser.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Parser.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libs/3rdparty/cplusplus/Parser.h b/src/libs/3rdparty/cplusplus/Parser.h index c18a079e4e..10f8f6c542 100644 --- a/src/libs/3rdparty/cplusplus/Parser.h +++ b/src/libs/3rdparty/cplusplus/Parser.h @@ -142,7 +142,7 @@ public: bool parsePtrOperator(PtrOperatorListAST *&node); bool parseRelationalExpression(ExpressionAST *&node); bool parseShiftExpression(ExpressionAST *&node); - bool parseStatement(StatementAST *&node); + bool parseStatement(StatementAST *&node, bool blockLabeledStatement = false); bool parseThisExpression(ExpressionAST *&node); bool parseBoolLiteral(ExpressionAST *&node); bool parseNumericLiteral(ExpressionAST *&node); |