Skip to content

Commit 4eab2d5

Browse files
Update testbufferoverrun.cpp
1 parent d9be3c3 commit 4eab2d5

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5515,6 +5515,19 @@ class TestBufferOverrun : public TestFixture {
55155515
" f(s);\n"
55165516
"}\n");
55175517
ASSERT_EQUALS("", errout_str());
5518+
5519+
setMultiline();
5520+
ctu("void g(char* p) {\n"
5521+
" memset(p + 10, 0, 10);\n"
5522+
"}\n"
5523+
"void f() {\n"
5524+
" char a[10] = {};\n"
5525+
" g(a);\n"
5526+
"}");
5527+
ASSERT_EQUALS("[test.cpp:2:12]: error: Pointer arithmetic overflow; 'p' buffer size is 10 [ctuPointerArith]\n"
5528+
"[test.cpp:6:6]: note: Calling function g, 1st argument is accessed out of bounds\n"
5529+
"[test.cpp:2:12]: note: Using argument p\n",
5530+
errout_str());
55185531
}
55195532

55205533
void objectIndex() {

0 commit comments

Comments
 (0)