Skip to content

Commit 7eda773

Browse files
Fix #12801 fuzzing timeout/out-of-memory in Tokenizer::simplifyTypedefCpp() (danmar#6475)
1 parent edf0104 commit 7eda773

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/tokenize.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8752,6 +8752,13 @@ void Tokenizer::findGarbageCode() const
87528752
}
87538753
if (!tok2->next() || tok2->isControlFlowKeyword() || Token::Match(tok2, "typedef|static|."))
87548754
syntaxError(tok);
8755+
if (Token::Match(tok2, "%name% %name%") && tok2->str() == tok2->strAt(1)) {
8756+
if (tok2->isStandardType() && tok2->str() == "long")
8757+
continue;
8758+
if (Token::Match(tok2->tokAt(-1), "enum|struct|union") || (isCPP() && Token::Match(tok2->tokAt(-1), "class|::")))
8759+
continue;
8760+
syntaxError(tok2);
8761+
}
87558762
}
87568763
}
87578764
if (cpp && tok->str() == "namespace" && tok->tokAt(-1)) {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
typedef q k k k q,q k,q,k,q,k,q k,q,k,q,k,;

0 commit comments

Comments
 (0)