Skip to content

Commit 88a9426

Browse files
Update testbufferoverrun.cpp
1 parent 0b19a52 commit 88a9426

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/testbufferoverrun.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3564,6 +3564,14 @@ class TestBufferOverrun : public TestFixture {
35643564
" memset(&a[i], 0, sizeof(a));\n"
35653565
"}\n");
35663566
ASSERT_EQUALS("[test.cpp:4:16]: (error) Buffer is accessed out of bounds: &a[i] [bufferAccessOutOfBounds]\n", errout_str());
3567+
3568+
check("void f(const std::vector<uint8_t>& s) {\n" // #14948
3569+
" if (s.size() < 4)\n"
3570+
" return;\n"
3571+
" uint32_t u = 0;\n"
3572+
" std::memcpy(&u, &s[0], sizeof(u));\n"
3573+
"}\n");
3574+
ASSERT_EQUALS("", errout_str());
35673575
}
35683576

35693577
void buffer_overrun_errorpath() {

0 commit comments

Comments
 (0)