sanity check for ticket #3387 ( buffer access out of bounds)

This commit is contained in:
Ettl Martin 2011-12-06 20:53:56 +01:00
parent 0504952950
commit 4884a1dfe0
1 changed files with 10 additions and 0 deletions

View File

@ -113,6 +113,7 @@ private:
TEST_CASE(array_index_36); // ticket #2960
TEST_CASE(array_index_37);
TEST_CASE(array_index_38); // ticket #3273
TEST_CASE(array_index_39);
TEST_CASE(array_index_multidim);
TEST_CASE(array_index_switch_in_for);
TEST_CASE(array_index_for_in_for); // FP: #2634
@ -1290,6 +1291,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void array_index_39() { // ticket 3387
check("void aFunction()\n"
"{\n"
" char a[10];\n"
" a[10] = 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[10]' index 10 out of bounds\n", errout.str());
}
void array_index_multidim() {
check("void f()\n"
"{\n"