Skip to content

Commit

Permalink
Fix #12512 fuzzing timeout in compileExpression() (#6160)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 20, 2024
1 parent c98029b commit 63eac64
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/tokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,10 @@ static Token * createAstAtToken(Token *tok)
void TokenList::createAst() const
{
for (Token *tok = mTokensFrontBack.front; tok; tok = tok ? tok->next() : nullptr) {
tok = createAstAtToken(tok);
Token* const nextTok = createAstAtToken(tok);
if (precedes(nextTok, tok))
throw InternalError(tok, "Syntax Error: Infinite loop when creating AST.", InternalError::AST);
tok = nextTok;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
;new t()

0 comments on commit 63eac64

Please sign in to comment.