Skip to content

Commit

Permalink
Fix #12702 fuzzing crash in TemplateSimplifier::useDefaultArgumentVal…
Browse files Browse the repository at this point in the history
…ues (danmar#6387)
  • Loading branch information
chrchr-github authored May 10, 2024
1 parent 89f5657 commit 37dc795
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 37dc795

Please sign in to comment.