forked from qt-creator/qt-creator
C++: Limit parsing of initializer clauses II
This completes
commit e69d20e10b
C++: Limit parsing of initializer clauses
by handling the following code path:
-------- parseExpressionStatement
--------- parseExpression
---------- parseCastExpression
----------- parseUnaryExpression
------------ parsePostfixExpression
------------- parseCorePostfixExpression
-------------- parsePrimaryExpression
--------------- parseNumericLiteral
---------- parseExpressionWithOperatorPrecedence
----------- parseInitializerClause0x
------------ parseAssignmentExpression
------------- parseCastExpression
-------------- parseUnaryExpression
--------------- parsePostfixExpression
---------------- parseCorePostfixExpression
----------------- parsePrimaryExpression
------------------ parseNumericLiteral
------------- parseExpressionWithOperatorPrecedence
----------- parseInitializerClause0x
------------ parseAssignmentExpression
------------- parseCastExpression
-------------- parseUnaryExpression
--------------- parsePostfixExpression
---------------- parseCorePostfixExpression
----------------- parsePrimaryExpression
------------------ parseNumericLiteral
------------- parseExpressionWithOperatorPrecedence
----------- parseInitializerClause0x
...
Task-number: QTCREATORBUG-14645
Change-Id: I8a71fd687e15a3a4ae26e7b9830276464e3fa76e
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
This commit is contained in:
6
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
6
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
@@ -5593,7 +5593,13 @@ void Parser::parseExpressionWithOperatorPrecedence(ExpressionAST *&lhs, int minP
|
||||
{
|
||||
DEBUG_THIS_RULE();
|
||||
|
||||
unsigned iterations = 0;
|
||||
while (precedence(tok().kind(), _templateArguments) >= minPrecedence) {
|
||||
if (++iterations > MAX_EXPRESSION_DEPTH) {
|
||||
warning(cursor(), "Reached parse limit for expression");
|
||||
return;
|
||||
}
|
||||
|
||||
const int operPrecedence = precedence(tok().kind(), _templateArguments);
|
||||
const int oper = consumeToken();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user