Skip to content

Commit faf6e2f

Browse files
committed
Fix #13704 fuzzing crash (null-pointer-use) in TokenList::insertTokens()
1 parent 0d7afa2 commit faf6e2f

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

lib/tokenize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7580,6 +7580,8 @@ void Tokenizer::simplifyVarDecl(Token * tokBegin, const Token * const tokEnd, co
75807580
if (!varTok)
75817581
syntaxError(tok2); // invalid code
75827582
if (eq->str() == "=") {
7583+
if (varTok->index() + 1 > list.back()->index())
7584+
syntaxError(tok2);
75837585
TokenList::insertTokens(eq, varTok, 2);
75847586
eq->str(";");
75857587
eq->isSplittedVarDeclEq(true);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c<a<s>s=t,{;{}}>l

0 commit comments

Comments
 (0)