Skip to content

Commit

Permalink
Fix #12652, #12654 fuzzing crashes (#6344)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 26, 2024
1 parent e5659cc commit 7a3a43b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4352,7 +4352,7 @@ static void setVarIdStructMembers(Token *&tok1,

while (Token::Match(tok->next(), ")| . %name% !!(")) {
// Don't set varid for trailing return type
if (tok->strAt(1) == ")" && (tok->linkAt(1)->previous()->isName() || tok->linkAt(1)->strAt(-1) == "]") &&
if (tok->strAt(1) == ")" && Token::Match(tok->linkAt(1)->tokAt(-1), "%name%|]") &&
Tokenizer::isFunctionHead(tok->linkAt(1), "{|;")) {
tok = tok->tokAt(3);
continue;
Expand Down Expand Up @@ -10610,6 +10610,8 @@ void Tokenizer::simplifyNamespaceAliases()
else if (Token::Match(tok, "namespace %name% =") || (isPrev = Token::Match(tok->previous(), "namespace %name% ="))) {
if (isPrev)
tok = tok->previous();
if (tok->tokAt(-1) && !Token::Match(tok->tokAt(-1), "[;{}]"))
syntaxError(tok->tokAt(-1));
const std::string name(tok->next()->str());
Token * tokNameStart = tok->tokAt(3);
Token * tokNameEnd = tokNameStart;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(h l).h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
S namespace d=S;e namespace d=a

0 comments on commit 7a3a43b

Please sign in to comment.