Skip to content

Commit

Permalink
Fix #12702 fuzzing crash in TemplateSimplifier::useDefaultArgumentValues
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed May 6, 2024
1 parent 50be22d commit 806d438
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8766,6 +8766,8 @@ void Tokenizer::findGarbageCode() const
// Garbage templates..
if (isCPP()) {
for (const Token *tok = tokens(); tok; tok = tok->next()) {
if (Token::simpleMatch(tok, "< >") && !(Token::Match(tok->tokAt(-1), "%name%") || (tok->tokAt(-1) && Token::Match(tok->tokAt(-2), "operator %op%"))))
syntaxError(tok);
if (!Token::simpleMatch(tok, "template <"))
continue;
if (tok->previous() && !Token::Match(tok->previous(), ":|;|{|}|)|>|\"C++\"")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
template<#p<>tu< <>tu=e

0 comments on commit 806d438

Please sign in to comment.