Skip to content

Commit

Permalink
Fix #12512 fuzzing timeout in compileExpression()
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 20, 2024
1 parent e2081e8 commit f6df408
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 f6df408

Please sign in to comment.