[PATCH] D26638: Don't pass nullptr into memcpy

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 14 14:15:16 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL286896: Don't pass nullptr into memcpy (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D26638?vs=77887&id=77888#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26638

Files:
  llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h


Index: llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h
===================================================================
--- llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h
+++ llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h
@@ -91,6 +91,9 @@
   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())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26638.77888.patch
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161114/8b1f9bf2/attachment.bin>


More information about the llvm-commits mailing list