#7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1

This commit is contained in:
amai2012 2015-12-26 20:16:01 +01:00
parent c672210e06
commit 36a6599386
2 changed files with 7 additions and 1 deletions

View File

@ -3025,7 +3025,7 @@ void Tokenizer::setVarId()
vartok->varId(varpos->second);
if (vartok->strAt(1) == "<") {
tok3 = vartok->next()->findClosingBracket();
if (tok3 && tok3->next()->link())
if (tok3 && tok3->next() && tok3->next()->link())
tok3 = tok3->next()->link();
} else
tok3 = vartok->linkAt(1);

View File

@ -212,6 +212,7 @@ private:
TEST_CASE(garbageCode161); // #7200
TEST_CASE(garbageCode162); // #7208
TEST_CASE(garbageCode163); // #7228
TEST_CASE(garbageCode164); // #7234
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
TEST_CASE(garbageAST);
@ -1399,6 +1400,11 @@ private:
ASSERT_THROW(checkCode("typedef s f[](){typedef d h(;f)}", false), InternalError);
}
void garbageCode164() {
//7234
ASSERT_THROW(checkCode("class d{k p;}(){d::d():B<()}", false), InternalError);
}
};
REGISTER_TEST(TestGarbage)