Skip to content

Commit 0539dee

Browse files
Fix #13702, #13713 fuzzing crashes (danmar#8071)
Co-authored-by: chrchr-github <noreply@github.com>
1 parent a30d718 commit 0539dee

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

lib/symboldatabase.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,10 @@ void SymbolDatabase::createSymbolDatabaseIncompleteVars()
15081508
continue;
15091509
}
15101510
if (tok->str() == "using") {
1511-
tok = Token::findsimplematch(tok, ";");
1511+
Token* usingEnd = Token::findsimplematch(tok, ";");
1512+
if (!usingEnd)
1513+
mTokenizer.syntaxError(tok);
1514+
tok = usingEnd;
15121515
continue;
15131516
}
15141517
}

lib/tokenize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8940,6 +8940,8 @@ void Tokenizer::findGarbageCode() const
89408940
syntaxError(tok);
89418941
if (Token::Match(tok, ": [)]=]"))
89428942
syntaxError(tok);
8943+
if (Token::simpleMatch(tok, ", :"))
8944+
syntaxError(tok);
89438945
if (Token::Match(tok, "typedef [,;:]"))
89448946
syntaxError(tok);
89458947
if (Token::Match(tok, "!|~ %comp%") &&
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
b f(){using e}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
t o(){for(u*e,:c)t c=e;}

0 commit comments

Comments
 (0)