fix segfault: #2591 (cppcheck hangs with 100% cpu load ( class A : ))
This commit is contained in:
parent
55711698d0
commit
5f84272a52
|
@ -899,7 +899,7 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
|
|||
tok2 = tok2->next();
|
||||
|
||||
// check for invalid code
|
||||
if (!tok2->next())
|
||||
if (!tok2 || !tok2->next())
|
||||
return NULL;
|
||||
|
||||
if (tok2->str() == "public")
|
||||
|
|
|
@ -195,6 +195,7 @@ private:
|
|||
TEST_CASE(symboldatabase12); // ticket #2547
|
||||
TEST_CASE(symboldatabase13); // ticket #2577
|
||||
TEST_CASE(symboldatabase14); // ticket #2589
|
||||
TEST_CASE(symboldatabase15); // ticket #2591
|
||||
}
|
||||
|
||||
// Check the operator Equal
|
||||
|
@ -5596,6 +5597,14 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase15()
|
||||
{
|
||||
// ticket #2591 - segmentation fault
|
||||
checkConst("struct A :\n");
|
||||
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestClass)
|
||||
|
|
Loading…
Reference in New Issue