Fixed #9034 (crash on reading invalid code: '> typedef')

This commit is contained in:
Daniel Marjamäki 2019-03-26 16:14:21 +01:00
parent 68dd203f43
commit 15676612c0
2 changed files with 3 additions and 0 deletions

View File

@ -9046,6 +9046,8 @@ void Tokenizer::findGarbageCode() const
for (const Token *tok = tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "%name% %name%") && nonConsecutiveKeywords.count(tok->str()) == 1 && nonConsecutiveKeywords.count(tok->next()->str()) == 1)
syntaxError(tok);
if (Token::Match(tok, "%op% %name%") && nonConsecutiveKeywords.count(tok->next()->str()) == 1)
syntaxError(tok);
}
// case keyword must be inside switch

View File

@ -1655,6 +1655,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
ASSERT_THROW(checkCode("void f() { x= 'x' > typedef name5 | ( , ;){ } (); }"), InternalError); // #9067
}
void enumTrailingComma() {