Fix #2847, cppcheck hangs with 100% cpu load
http://sourceforge.net/apps/trac/cppcheck/ticket/2847
This commit is contained in:
parent
e4f6d4c987
commit
5a72bed064
|
@ -55,7 +55,7 @@ void CheckPostfixOperator::postfixOperator()
|
||||||
else if (tok->strAt(-2) == ",")
|
else if (tok->strAt(-2) == ",")
|
||||||
{
|
{
|
||||||
int i(1);
|
int i(1);
|
||||||
while (tok->strAt(i) != ")")
|
while (tok->strAt(i) != ")" && tok->tokAt(i) != 0)
|
||||||
{
|
{
|
||||||
if (tok->strAt(i) == ";")
|
if (tok->strAt(i) == ";")
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,13 @@ private:
|
||||||
TEST_CASE(testiterator);
|
TEST_CASE(testiterator);
|
||||||
TEST_CASE(test2168);
|
TEST_CASE(test2168);
|
||||||
TEST_CASE(pointer); // #2321 - postincrement of pointer is OK
|
TEST_CASE(pointer); // #2321 - postincrement of pointer is OK
|
||||||
|
TEST_CASE(testHangWithInvalidCode); // #2847 - cppcheck hangs with 100% cpu load
|
||||||
|
}
|
||||||
|
|
||||||
|
void testHangWithInvalidCode()
|
||||||
|
{
|
||||||
|
check("a,b--\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void testsimple()
|
void testsimple()
|
||||||
|
|
Loading…
Reference in New Issue