You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Buffer access out of bounds; '" + unsafeUsage.myArgumentName + "' buffer size is " + MathLib::toString(functionCall->callArgValue) + " and it is accessed at offset " + MathLib::toString(unsafeUsage.value) + ".",
errmsg = "Array index out of bounds; '" + unsafeUsage.myArgumentName + "' buffer size is " + MathLib::toString(functionCall->callArgValue) + " and it is accessed at offset " + MathLib::toString(unsafeUsage.value) + ".";
864
+
else
865
+
errmsg = "Array index out of bounds; buffer '" + unsafeUsage.myArgumentName + "' is accessed at offset " + MathLib::toString(unsafeUsage.value) + ".";
Copy file name to clipboardExpand all lines: test/testbufferoverrun.cpp
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -249,6 +249,7 @@ class TestBufferOverrun : public TestFixture {
249
249
TEST_CASE(ctu_malloc);
250
250
TEST_CASE(ctu_array);
251
251
TEST_CASE(ctu_variable);
252
+
TEST_CASE(ctu_arithmetic);
252
253
}
253
254
254
255
@@ -4088,7 +4089,7 @@ class TestBufferOverrun : public TestFixture {
4088
4089
" char *s = malloc(4);\n"
4089
4090
" dostuff(s);\n"
4090
4091
"}");
4091
-
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:7] -> [test.cpp:2]: (error) Buffer access out of bounds; buffer 'p' is accessed at offset -3.\n", errout.str());
4092
+
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:7] -> [test.cpp:2]: (error) Array index out of bounds; buffer 'p' is accessed at offset -3.\n", errout.str());
4092
4093
4093
4094
ctu("void dostuff(char *p) {\n"
4094
4095
" p[4] = 0;\n"
@@ -4098,7 +4099,7 @@ class TestBufferOverrun : public TestFixture {
4098
4099
" char *s = malloc(4);\n"
4099
4100
" dostuff(s);\n"
4100
4101
"}");
4101
-
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:7] -> [test.cpp:2]: (error) Buffer access out of bounds; 'p' buffer size is 4 and it is accessed at offset 4.\n", errout.str());
4102
+
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:7] -> [test.cpp:2]: (error) Array index out of bounds; 'p' buffer size is 4 and it is accessed at offset 4.\n", errout.str());
4102
4103
}
4103
4104
4104
4105
voidctu_array() {
@@ -4109,7 +4110,7 @@ class TestBufferOverrun : public TestFixture {
4109
4110
" char str[4];\n"
4110
4111
" dostuff(str);\n"
4111
4112
"}");
4112
-
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:2]: (error) Buffer access out of bounds; 'p' buffer size is 4 and it is accessed at offset 10.\n", errout.str());
4113
+
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:2]: (error) Array index out of bounds; 'p' buffer size is 4 and it is accessed at offset 10.\n", errout.str());
4113
4114
4114
4115
ctu("static void memclr( char *data )\n"
4115
4116
"{\n"
@@ -4121,7 +4122,7 @@ class TestBufferOverrun : public TestFixture {
4121
4122
" char str[5];\n"
4122
4123
" memclr( str );\n"
4123
4124
"}");
4124
-
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Buffer access out of bounds; 'data' buffer size is 5 and it is accessed at offset 10.\n", errout.str());
4125
+
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Array index out of bounds; 'data' buffer size is 5 and it is accessed at offset 10.\n", errout.str());
4125
4126
4126
4127
ctu("static void memclr( int i, char *data )\n"
4127
4128
"{\n"
@@ -4133,7 +4134,7 @@ class TestBufferOverrun : public TestFixture {
4133
4134
" char str[5];\n"
4134
4135
" memclr( 0, str );\n"
4135
4136
"}");
4136
-
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Buffer access out of bounds; 'data' buffer size is 5 and it is accessed at offset 10.\n", errout.str());
4137
+
ASSERT_EQUALS("[test.cpp:9] -> [test.cpp:3]: (error) Array index out of bounds; 'data' buffer size is 5 and it is accessed at offset 10.\n", errout.str());
4137
4138
4138
4139
ctu("static void memclr( int i, char *data )\n"
4139
4140
"{\n"
@@ -4185,7 +4186,16 @@ class TestBufferOverrun : public TestFixture {
4185
4186
" int x = 4;\n"
4186
4187
" dostuff(&x);\n"
4187
4188
"}");
4188
-
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:2]: (error) Buffer access out of bounds; 'p' buffer size is 4 and it is accessed at offset 40.\n", errout.str());
4189
+
ASSERT_EQUALS("[test.cpp:6] -> [test.cpp:2]: (error) Array index out of bounds; 'p' buffer size is 4 and it is accessed at offset 40.\n", errout.str());
0 commit comments