Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode)

This commit is contained in:
Akhilesh Nema 2015-12-09 14:00:40 +01:00 committed by Daniel Marjamäki
parent be0b28f802
commit 932f6ea81b
2 changed files with 7 additions and 2 deletions

View File

@ -1835,6 +1835,7 @@ bool Tokenizer::tokenizeCondition(const std::string &code)
void Tokenizer::findComplicatedSyntaxErrorsInTemplates()
{
validate();
TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates(list.front());
}
@ -3495,7 +3496,7 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
// Remove __declspec()
simplifyDeclspec();
validate();
// remove some unhandled macros in global scope
removeMacrosInGlobalScope();

View File

@ -209,7 +209,7 @@ private:
TEST_CASE(garbageCode158); // #3238
TEST_CASE(garbageCode159); // #7119
TEST_CASE(garbageCode160); // #7190
TEST_CASE(garbageCode161); // #7200
TEST_CASE(garbageValueFlow);
TEST_CASE(garbageSymbolDatabase);
TEST_CASE(garbageAST);
@ -1382,6 +1382,10 @@ private:
// #4169
checkCode("volatile true , test < test < #ifdef __ppc__ true ,");
}
void garbageCode161() {
//7200
ASSERT_THROW(checkCode("{ }{ if () try { } catch (...)} B : : ~B { }"), InternalError);
}
};
REGISTER_TEST(TestGarbage)