Index: include/llvm/DebugInfo/MSF/ByteStream.h =================================================================== --- include/llvm/DebugInfo/MSF/ByteStream.h +++ include/llvm/DebugInfo/MSF/ByteStream.h @@ -91,16 +91,14 @@ uint32_t getLength() const override { return ImmutableStream.getLength(); } Error writeBytes(uint32_t Offset, ArrayRef Buffer) const override { - if (Buffer.empty()) - return Error::success(); - if (Data.size() < Buffer.size()) return make_error(msf_error_code::insufficient_buffer); if (Offset > Buffer.size() - Data.size()) return make_error(msf_error_code::insufficient_buffer); uint8_t *DataPtr = const_cast(Data.data()); - ::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size()); + if (!Buffer.empty()) + ::memcpy(DataPtr + Offset, Buffer.data(), Buffer.size()); return Error::success(); }