Skip to content

Commit 8ae11ea

Browse files
Fix #13166 fuzzing crash (heap-use-after-free) in Tokenizer::simplifyTypedefCpp() (danmar#6905)
1 parent f216233 commit 8ae11ea

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/tokenize.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,11 @@ void Tokenizer::simplifyTypedefCpp()
15281528
argEnd = tokOffset->linkAt(1);
15291529
if (!argEnd)
15301530
syntaxError(argStart);
1531+
const Token* tok2 = argEnd->next();
1532+
while (tok2 && (tok2->isKeyword() || tok2->str() == ")"))
1533+
tok2 = tok2->next();
1534+
if (!Token::simpleMatch(tok2, ";"))
1535+
syntaxError(tok2);
15311536

15321537
tok = argEnd->next();
15331538
Token *spec = tok;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
typedef e*(C)()const C;

0 commit comments

Comments
 (0)