CPlusPlus: Fix parser crash

The parseCompoundStatement() function can return without setting the
output parameter if the maximum statement depth is exceeded.

Task-number: QTCREATORBUG-29847
Change-Id: Ifd76cd948c30498863246a1b80bd0657950101ca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-24 13:18:20 +01:00
parent e2c1d12a05
commit badc0b4ea5

View File

@@ -4946,7 +4946,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
CompoundExpressionAST *ast = new (_pool) CompoundExpressionAST;
ast->lparen_token = consumeToken();
StatementAST *statement = nullptr;
parseCompoundStatement(statement);
if (parseCompoundStatement(statement))
ast->statement = statement->asCompoundStatement();
match(T_RPAREN, &ast->rparen_token);
node = ast;