Skip to content

Commit

Permalink
Fix #12801 fuzzing timeout/out-of-memory in Tokenizer::simplifyTypede…
Browse files Browse the repository at this point in the history
…fCpp() (#6475)
  • Loading branch information
chrchr-github authored Jun 2, 2024
1 parent edf0104 commit 7eda773
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8752,6 +8752,13 @@ void Tokenizer::findGarbageCode() const
}
if (!tok2->next() || tok2->isControlFlowKeyword() || Token::Match(tok2, "typedef|static|."))
syntaxError(tok);
if (Token::Match(tok2, "%name% %name%") && tok2->str() == tok2->strAt(1)) {
if (tok2->isStandardType() && tok2->str() == "long")
continue;
if (Token::Match(tok2->tokAt(-1), "enum|struct|union") || (isCPP() && Token::Match(tok2->tokAt(-1), "class|::")))
continue;
syntaxError(tok2);
}
}
}
if (cpp && tok->str() == "namespace" && tok->tokAt(-1)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef q k k k q,q k,q,k,q,k,q k,q,k,q,k,;

0 comments on commit 7eda773

Please sign in to comment.