Skip to content

Commit 0e4fc20

Browse files
committed
Move test
1 parent d9b785a commit 0e4fc20

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,13 +3572,6 @@ class TestBufferOverrun : public TestFixture {
35723572
" std::memcpy(&u, &s[0], sizeof(u));\n"
35733573
"}\n");
35743574
ASSERT_EQUALS("", errout_str());
3575-
3576-
check("void f(const std::vector<uint8_t>& s) {\n"
3577-
" if (s.size() == 2) {}\n"
3578-
" uint32_t u = 0;\n"
3579-
" std::memcpy(&u, &s[0], sizeof(u));\n"
3580-
"}\n");
3581-
ASSERT_EQUALS("[test.cpp:4:21]: (warning) Buffer is accessed out of bounds: &s[0] [bufferAccessOutOfBounds]\n", errout_str());
35823575
}
35833576

35843577
void buffer_overrun_errorpath() {
@@ -3593,6 +3586,15 @@ class TestBufferOverrun : public TestFixture {
35933586
ASSERT_EQUALS("[test.cpp:3:12]: error: Buffer is accessed out of bounds: p [bufferAccessOutOfBounds]\n"
35943587
"[test.cpp:2:13]: note: Assign p, buffer with size 10\n"
35953588
"[test.cpp:3:12]: note: Buffer overrun\n", errout_str());
3589+
3590+
check("void f(const std::vector<uint8_t>& s) {\n"
3591+
" if (s.size() == 2) {}\n"
3592+
" uint32_t u = 0;\n"
3593+
" std::memcpy(&u, &s[0], sizeof(u));\n"
3594+
"}\n", s);
3595+
ASSERT_EQUALS("[test.cpp:4:21]: warning: Buffer is accessed out of bounds: &s[0] [bufferAccessOutOfBounds]\n"
3596+
"[test.cpp:2:18]: note: Assuming that condition 's.size()==2' is not redundant\n"
3597+
"[test.cpp:4:21]: note: Buffer overrun\n", errout_str());
35963598
}
35973599

35983600
void buffer_overrun_bailoutIfSwitch() {

0 commit comments

Comments
 (0)