testbufferoverrun : Added a testcase where variable id is needed to avoid false positive

This commit is contained in:
Daniel Marjamäki 2008-12-12 19:16:30 +00:00
parent edff8d326f
commit 90bc72a413
1 changed files with 19 additions and 1 deletions

View File

@ -78,7 +78,9 @@ private:
TEST_CASE( array_index_12 );
TEST_CASE( buffer_overrun_1 );
TEST_CASE( buffer_overrun_2 );
TEST_CASE( buffer_overrun_2 );
// TODO TEST_CASE( varid1 );
}
@ -352,6 +354,22 @@ private:
ASSERT_EQUALS( std::string("[test.cpp:8]: Buffer overrun\n"), errout.str() );
}
void varid1()
{
check( "void foo()\n"
"{\n"
" char str[10];\n"
" if (str[0])\n"
" {\n"
" char str[50];\n"
" str[30] = 0;\n"
" }\n"
"}\n" );
ASSERT_EQUALS( std::string(""), errout.str() );
}
};