Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun

This commit is contained in:
Daniel Marjamäki 2010-11-07 17:42:32 +01:00
parent 47e9fcb5a8
commit 586f4992d8
2 changed files with 3 additions and 5 deletions

View File

@ -6095,7 +6095,7 @@ bool Tokenizer::simplifyKnownVariables()
}
// array usage
if (Token::Match(tok3, "( %varid% [", varid))
if (Token::Match(tok3, "[(,] %varid% [+-*/[]", varid))
{
tok3 = tok3->next();
tok3->str(value);

View File

@ -1359,8 +1359,7 @@ private:
"char str[i];\n"
"fread(str,sizeof(char),i+1,fd);\n"
"}\n");
ASSERT_EQUALS("", errout.str()); // catch changes
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds: str\n", errout.str());
check("void f(FILE* fd)\n"
"{\n"
@ -1383,8 +1382,7 @@ private:
"char str[i];\n"
"fwrite(str,sizeof(char),i+1,fd);\n"
"}\n");
ASSERT_EQUALS("", errout.str()); // catch changes
TODO_ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds\n", errout.str());
ASSERT_EQUALS("[test.cpp:5]: (error) Buffer access out-of-bounds: str\n", errout.str());
check("void f(FILE* fd)\n"
"{\n"