mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-27 15:22:29 +00:00
Don't pass nullptr into memcpy
Summary: It's undefined according UBSAN. Not sure which CL caused test failures, but seems writeBytes for empty buffer should be OK. Reviewers: rnk, zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26638 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286896 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
107362cf5f
commit
5ffd1d01cc
@ -91,6 +91,9 @@ public:
|
||||
uint32_t getLength() const override { return ImmutableStream.getLength(); }
|
||||
|
||||
Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Buffer) const override {
|
||||
if (Buffer.empty())
|
||||
return Error::success();
|
||||
|
||||
if (Data.size() < Buffer.size())
|
||||
return make_error<MSFError>(msf_error_code::insufficient_buffer);
|
||||
if (Offset > Buffer.size() - Data.size())
|
||||
|
Loading…
x
Reference in New Issue
Block a user