@@ -460,7 +460,8 @@ class TestBufferOverrun : public TestFixture {
460460 " struct ABC* x = malloc(sizeof(struct ABC) + 10);\n "
461461 " x->str[1] = 0;"
462462 " }" );
463- ASSERT_EQUALS (" [test.cpp:10]: (error) Array 'x.str[1]' accessed at index 1, which is out of bounds.\n " , errout.str ());
463+ ASSERT_EQUALS (" [test.cpp:10]: (error) Array 'x->str[1]' accessed at index 1, which is out of bounds.\n "
464+ " [test.cpp:10]: (error) Array 'x.str[1]' accessed at index 1, which is out of bounds.\n " , errout.str ());
464465
465466 // This is not out of bounds because it is a variable length array
466467 // and the index is within the memory allocated.
@@ -582,7 +583,8 @@ class TestBufferOverrun : public TestFixture {
582583 " {\n "
583584 " abc->str[10] = 0;\n "
584585 " }" );
585- ASSERT_EQUALS (" [test.cpp:8]: (error) Array 'abc.str[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
586+ ASSERT_EQUALS (" [test.cpp:8]: (error) Array 'abc->str[10]' accessed at index 10, which is out of bounds.\n "
587+ " [test.cpp:8]: (error) Array 'abc.str[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
586588 }
587589
588590 void array_index_9 () {
@@ -669,7 +671,8 @@ class TestBufferOverrun : public TestFixture {
669671 " abc->str[10] = 0;\n "
670672 " }\n "
671673 " }" );
672- ASSERT_EQUALS (" [test.cpp:13]: (error) Array 'abc.str[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
674+ ASSERT_EQUALS (" [test.cpp:13]: (error) Array 'abc->str[10]' accessed at index 10, which is out of bounds.\n "
675+ " [test.cpp:13]: (error) Array 'abc.str[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
673676 }
674677
675678 void array_index_12 () {
@@ -1131,6 +1134,9 @@ class TestBufferOverrun : public TestFixture {
11311134 ASSERT_EQUALS (" [test.cpp:9]: (error) Array 'test.a[10]' accessed at index 10, which is out of bounds.\n "
11321135 " [test.cpp:10]: (error) Array 'test.b[10][5]' index test.b[10][2] out of bounds.\n "
11331136 " [test.cpp:11]: (error) Array 'test.b[10][5]' index test.b[0][19] out of bounds.\n "
1137+ " [test.cpp:14]: (error) Array 'ptest->a[10]' accessed at index 10, which is out of bounds.\n "
1138+ " [test.cpp:15]: (error) Array 'ptest->b[10][5]' index ptest->b[10][2] out of bounds.\n "
1139+ " [test.cpp:16]: (error) Array 'ptest->b[10][5]' index ptest->b[0][19] out of bounds.\n "
11341140 " [test.cpp:14]: (error) Array 'ptest.a[10]' accessed at index 10, which is out of bounds.\n "
11351141 " [test.cpp:15]: (error) Array 'ptest.b[10][5]' index ptest.b[10][2] out of bounds.\n "
11361142 " [test.cpp:16]: (error) Array 'ptest.b[10][5]' index ptest.b[0][19] out of bounds.\n " , errout.str ());
@@ -1151,6 +1157,8 @@ class TestBufferOverrun : public TestFixture {
11511157 " }" );
11521158 ASSERT_EQUALS (" [test.cpp:8]: (error) Array 'test.a[10][5]' index test.a[9][5] out of bounds.\n "
11531159 " [test.cpp:9]: (error) Array 'test.a[10][5]' index test.a[0][50] out of bounds.\n "
1160+ " [test.cpp:12]: (error) Array 'ptest->a[10][5]' index ptest->a[9][5] out of bounds.\n "
1161+ " [test.cpp:13]: (error) Array 'ptest->a[10][5]' index ptest->a[0][50] out of bounds.\n "
11541162 " [test.cpp:12]: (error) Array 'ptest.a[10][5]' index ptest.a[9][5] out of bounds.\n "
11551163 " [test.cpp:13]: (error) Array 'ptest.a[10][5]' index ptest.a[0][50] out of bounds.\n " , errout.str ());
11561164 }
@@ -2056,7 +2064,8 @@ class TestBufferOverrun : public TestFixture {
20562064 " struct tt *tt=x;\n "
20572065 " tt->name[22] = 123;\n "
20582066 " }" );
2059- ASSERT_EQUALS (" [test.cpp:7]: (error) Array 'tt.name[21]' accessed at index 22, which is out of bounds.\n " , errout.str ());
2067+ ASSERT_EQUALS (" [test.cpp:7]: (error) Array 'tt->name[21]' accessed at index 22, which is out of bounds.\n "
2068+ " [test.cpp:7]: (error) Array 'tt.name[21]' accessed at index 22, which is out of bounds.\n " , errout.str ());
20602069 }
20612070
20622071 void array_index_valueflow () {
@@ -2908,7 +2917,8 @@ class TestBufferOverrun : public TestFixture {
29082917 " Fred *f; f = new Fred;\n "
29092918 " return f->c[10];\n "
29102919 " }" );
2911- ASSERT_EQUALS (" [test.cpp:5]: (error) Array 'f.c[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
2920+ ASSERT_EQUALS (" [test.cpp:5]: (error) Array 'f->c[10]' accessed at index 10, which is out of bounds.\n "
2921+ " [test.cpp:5]: (error) Array 'f.c[10]' accessed at index 10, which is out of bounds.\n " , errout.str ());
29122922
29132923 check (" static const size_t MAX_SIZE = UNAVAILABLE_TO_CPPCHECK;\n "
29142924 " struct Thing { char data[MAX_SIZE]; };\n "
0 commit comments