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

@ -79,6 +79,8 @@ private:
TEST_CASE( buffer_overrun_1 );
TEST_CASE( buffer_overrun_2 );
// TODO TEST_CASE( varid1 );
}
@ -353,6 +355,22 @@ private:
}
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() );
}
};
REGISTER_TEST( TestBufferOverrun )