Fixed #9063 (Crash on invalid code: x='0' ++ '0' ( return)[ ];)
This commit is contained in:
parent
10fcf731d9
commit
49e2f9d551
|
@ -8508,6 +8508,12 @@ void Tokenizer::findGarbageCode() const
|
|||
unknownMacroError(tok->linkAt(1)->previous());
|
||||
}
|
||||
|
||||
// Assign/increment/decrement literal
|
||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok,"%num%|%str%|%char% %assign%|++|--"))
|
||||
syntaxError(tok);
|
||||
}
|
||||
|
||||
for (const Token *tok = tokens(); tok; tok = tok->next()) {
|
||||
if (Token::Match(tok, "if|while|for|switch")) { // if|while|for|switch (EXPR) { ... }
|
||||
if (tok->previous() && !Token::Match(tok->previous(), "%name%|:|;|{|}|(|)|,"))
|
||||
|
|
|
@ -1654,6 +1654,7 @@ private:
|
|||
|
||||
void syntaxErrorFuzzerCliType1() {
|
||||
ASSERT_THROW(checkCode("void f(){x=0,return return''[]()}"), InternalError);
|
||||
ASSERT_THROW(checkCode("void f(){x='0'++'0'(return)[];}"), InternalError); // #9063
|
||||
}
|
||||
|
||||
void enumTrailingComma() {
|
||||
|
|
Loading…
Reference in New Issue