testbufferoverrun : Added a testcase where variable id is needed to avoid false positive
This commit is contained in:
parent
edff8d326f
commit
90bc72a413
|
@ -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() );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue