Skip to content

Commit 1a96ce8

Browse files
ludviggunnedanmar
andauthored
Fix #14918: fuzzing crash (stack-overflow) in findTokensSkipDeadCodeImpl() (#8732)
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
1 parent dbde189 commit 1a96ce8

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

lib/tokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8814,6 +8814,9 @@ void Tokenizer::findGarbageCode() const
88148814
if (!cpp || mSettings.standards.cpp < Standards::CPP20 || !Token::Match(tok->previous(), "%name% : %num% ="))
88158815
syntaxError(tok, tok->strAt(1) + " " + tok->strAt(2));
88168816
}
8817+
else if (!cpp && Token::Match(tok, "++|-- ++|--")) {
8818+
syntaxError(tok, tok->str() + tok->strAt(1));
8819+
}
88178820
else if (Token::simpleMatch(tok, ") return") && !Token::Match(tok->link()->previous(), "if|while|for (")) {
88188821
if (tok->link()->previous() && tok->link()->previous()->isUpperCaseName())
88198822
unknownMacroError(tok->link()->previous());
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d(){e?&d=d++++F:a}

0 commit comments

Comments
 (0)