Fix crashes detected with fuzzing

This commit is contained in:
Daniel Marjamäki 2018-01-25 15:53:58 +01:00
parent ce60b326f4
commit c04557eb73
2 changed files with 3 additions and 0 deletions

View File

@ -8362,6 +8362,8 @@ const Token * Tokenizer::findGarbageCode() const
return tok;
if (Token::Match(tok, ";|(|[ %comp%"))
return tok;
if (Token::Match(tok, "%cop%|= ]") && tok->str() != "&")
return tok;
}
// Code must not start with an arithmetical operand

View File

@ -1205,6 +1205,7 @@ private:
ASSERT_THROW(checkCode("void f() { x= name2 & name3 name2 = | 0.1 , | 0.1 , | 0.1 name4 <= >( ); }"), InternalError);
ASSERT_THROW(checkCode("void f() { x = , * [ | + 0xff | > 0xff]; }"), InternalError);
ASSERT_THROW(checkCode("void f() { x = , | 0xff , 0.1 < ; }"), InternalError);
ASSERT_THROW(checkCode("void f() { x = [ 1 || ] ; }"), InternalError);
}
void garbageValueFlow() {