diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 5e9017eb487..af8d20e17d8 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -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; } } diff --git a/test/cli/fuzz-timeout/timeout-0ee5eed9abd34e9d23640a5b82dd724affd05b79 b/test/cli/fuzz-timeout/timeout-0ee5eed9abd34e9d23640a5b82dd724affd05b79 new file mode 100644 index 00000000000..5f9465da55e --- /dev/null +++ b/test/cli/fuzz-timeout/timeout-0ee5eed9abd34e9d23640a5b82dd724affd05b79 @@ -0,0 +1 @@ +;new t() \ No newline at end of file