better test for symbol database bug fixed in last commit

This commit is contained in:
Robert Reif 2011-08-24 06:53:27 -04:00
parent 6f3131da8c
commit c4fdb8d113
1 changed files with 13 additions and 0 deletions

View File

@ -142,6 +142,7 @@ private:
TEST_CASE(buffer_overrun_18); // ticket #2576 - for, calculation with loop variable
TEST_CASE(buffer_overrun_19); // #2597 - class member with unknown type
TEST_CASE(buffer_overrun_20); // #2986 (segmentation fault)
TEST_CASE(buffer_overrun_21);
TEST_CASE(buffer_overrun_bailoutIfSwitch); // ticket #2378 : bailoutIfSwitch
TEST_CASE(possible_buffer_overrun_1); // #3035
@ -1978,6 +1979,18 @@ private:
ASSERT_EQUALS("", errout.str());
}
void buffer_overrun_21()
{
check("void foo()\n"
"{ { {\n"
" char dst[4];\n"
" const char *src = \"AAAAAAAAAAAAAAAAAAAAA\";\n"
" for (size_t i = 0; i <= 4; i++)\n"
" dst[i] = src[i];\n"
"} } }\n");
ASSERT_EQUALS("[test.cpp:6]: (error) Buffer access out-of-bounds: dst\n", errout.str());
}
void buffer_overrun_bailoutIfSwitch()
{
// No false positive