Skip to content

Commit 6fd916a

Browse files
committed
#3763 Added regression test
1 parent 9786f1c commit 6fd916a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class TestBufferOverrun : public TestFixture {
131131
TEST_CASE(array_index_48); // #9478
132132
TEST_CASE(array_index_49); // #8653
133133
TEST_CASE(array_index_50);
134+
TEST_CASE(array_index_51); // #3763
134135
TEST_CASE(array_index_multidim);
135136
TEST_CASE(array_index_switch_in_for);
136137
TEST_CASE(array_index_for_in_for); // FP: #2634
@@ -1525,6 +1526,14 @@ class TestBufferOverrun : public TestFixture {
15251526
ASSERT_EQUALS("", errout.str());
15261527
}
15271528

1529+
void array_index_51() {
1530+
check("void f(void){\n"
1531+
" int k=0, dd, d[1U] = {1};\n"
1532+
" for (dd=d[k]; k<10; dd=d[++k]){;}\n"
1533+
"}");
1534+
ASSERT_EQUALS("[test.cpp:3]: (error) Array 'd[1]' accessed at index 1, which is out of bounds.\n", errout.str());
1535+
}
1536+
15281537
void array_index_multidim() {
15291538
check("void f()\n"
15301539
"{\n"

0 commit comments

Comments
 (0)