File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,6 +132,7 @@ class TestBufferOverrun : public TestFixture {
132132 TEST_CASE (array_index_49); // #8653
133133 TEST_CASE (array_index_50);
134134 TEST_CASE (array_index_51); // #3763
135+ TEST_CASE (array_index_52); // #7682
135136 TEST_CASE (array_index_multidim);
136137 TEST_CASE (array_index_switch_in_for);
137138 TEST_CASE (array_index_for_in_for); // FP: #2634
@@ -1534,6 +1535,17 @@ class TestBufferOverrun : public TestFixture {
15341535 ASSERT_EQUALS (" [test.cpp:3]: (error) Array 'd[1]' accessed at index 1, which is out of bounds.\n " , errout.str ());
15351536 }
15361537
1538+ void array_index_52 () {
1539+ check (" char f(void)\n "
1540+ " {\n "
1541+ " char buf[10];\n "
1542+ " for(int i = 0, j= 11; i < j; ++i)\n "
1543+ " buf[i] = 0;\n "
1544+ " return buf[0];\n "
1545+ " }" );
1546+ ASSERT_EQUALS (" [test.cpp:5]: (error) Array 'buf[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
1547+ }
1548+
15371549 void array_index_multidim () {
15381550 check (" void f()\n "
15391551 " {\n "
You can’t perform that action at this time.
0 commit comments