Fixed crash on garbage code #6106

This commit is contained in:
PKEuS 2014-08-31 12:12:03 +02:00
parent 9733a751ec
commit 78932094c8
2 changed files with 6 additions and 0 deletions

View File

@ -1413,6 +1413,8 @@ static void valueFlowForLoop(TokenList *tokenlist, ErrorLogger *errorLogger, con
continue;
Token * const bodyStart = tok->linkAt(1)->next();
if (!bodyStart->link() || bodyStart->str() != "{")
continue;
unsigned int varid(0);
MathLib::bigint num1(0), num2(0), numAfter(0);

View File

@ -1263,6 +1263,10 @@ private:
" (foo(s, , 2, , , 5, , 7)) abort()\n"
"}\n";
ASSERT_THROW(valueOfTok(code, "*"), InternalError);
// #6106
code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }";
valueOfTok(code, "*");
}
};