#7190 Cppcheck hangs with 100% CPU load in Tokenizer::simplifyAttribute (invalidcode). Call validate() once more in Tokenizer::simplifyTokenList1 to trigger invalid code exception

This commit is contained in:
Alexander Mai 2015-12-05 13:55:33 +01:00
parent 308fd1ba50
commit 6ae1533cb4
2 changed files with 9 additions and 1 deletions

View File

@ -3502,6 +3502,9 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
// class Fred FINAL : Base { };
removeMacroInClassDef();
// That call here fixes #7190
validate();
// remove __attribute__((?))
simplifyAttribute();

View File

@ -208,6 +208,7 @@ private:
TEST_CASE(garbageCode157); // #7131
TEST_CASE(garbageCode158); // #3238
TEST_CASE(garbageCode159); // #7119
TEST_CASE(garbageCode160); // #7190
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
@ -1248,7 +1249,11 @@ private:
}
void garbageCode159() { // #7119
checkCode("({}typedef typename x;typename x!){({{}()})}"); // dont hang
checkCode("({}typedef typename x;typename x!){({{}()})}"); // don't hang
}
void garbageCode160() { // #7190
ASSERT_THROW(checkCode("f(a,b,c,d)float [ a[],d;int ] b[],c;{} "), InternalError); // don't hang
}