Skip to content

Commit 7a3a43b

Browse files
Fix #12652, #12654 fuzzing crashes (#6344)
1 parent e5659cc commit 7a3a43b

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

lib/tokenize.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4352,7 +4352,7 @@ static void setVarIdStructMembers(Token *&tok1,
43524352

43534353
while (Token::Match(tok->next(), ")| . %name% !!(")) {
43544354
// Don't set varid for trailing return type
4355-
if (tok->strAt(1) == ")" && (tok->linkAt(1)->previous()->isName() || tok->linkAt(1)->strAt(-1) == "]") &&
4355+
if (tok->strAt(1) == ")" && Token::Match(tok->linkAt(1)->tokAt(-1), "%name%|]") &&
43564356
Tokenizer::isFunctionHead(tok->linkAt(1), "{|;")) {
43574357
tok = tok->tokAt(3);
43584358
continue;
@@ -10610,6 +10610,8 @@ void Tokenizer::simplifyNamespaceAliases()
1061010610
else if (Token::Match(tok, "namespace %name% =") || (isPrev = Token::Match(tok->previous(), "namespace %name% ="))) {
1061110611
if (isPrev)
1061210612
tok = tok->previous();
10613+
if (tok->tokAt(-1) && !Token::Match(tok->tokAt(-1), "[;{}]"))
10614+
syntaxError(tok->tokAt(-1));
1061310615
const std::string name(tok->next()->str());
1061410616
Token * tokNameStart = tok->tokAt(3);
1061510617
Token * tokNameEnd = tokNameStart;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(h l).h
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
S namespace d=S;e namespace d=a

0 commit comments

Comments
 (0)