Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/testbufferoverrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class TestBufferOverrun : public TestFixture {
TEST_CASE(array_index_62); // #7684
TEST_CASE(array_index_63); // #10979
TEST_CASE(array_index_64); // #10878
TEST_CASE(array_index_65); // #11066
TEST_CASE(array_index_multidim);
TEST_CASE(array_index_switch_in_for);
TEST_CASE(array_index_for_in_for); // FP: #2634
Expand Down Expand Up @@ -1822,6 +1823,18 @@ class TestBufferOverrun : public TestFixture {
TODO_ASSERT_EQUALS("[test.cpp:3]: (error) Array 'x[10]' accessed at index 10, which is out of bounds.\n", "", errout.str());
}

void array_index_65() // #11066
{
check("char P[] = { 2, 1 };\n"
"char f[2];\n"
"void e(char* c) {\n"
" register j;\n"
" for (j = 0; j < 2; j++)\n"
" c[j] = f[P[j] - 1];\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}

void array_index_multidim() {
check("void f()\n"
"{\n"
Expand Down