[PATCH] D45789: Fix nullptr passed to memcpy in lld/COFF/Chunks.cpp
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 20 15:19:29 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD330490: Fix nullptr passed to memcpy in lld/COFF/Chunks.cpp (authored by inglorion, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45789?vs=143397&id=143400#toc
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D45789
Files:
COFF/Chunks.cpp
Index: COFF/Chunks.cpp
===================================================================
--- COFF/Chunks.cpp
+++ COFF/Chunks.cpp
@@ -271,7 +271,8 @@
return;
// Copy section contents from source object file to output file.
ArrayRef<uint8_t> A = getContents();
- memcpy(Buf + OutputSectionOff, A.data(), A.size());
+ if (!A.empty())
+ memcpy(Buf + OutputSectionOff, A.data(), A.size());
// Apply relocations.
size_t InputSize = getSize();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45789.143400.patch
Type: text/x-patch
Size: 463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180420/16c33a7e/attachment.bin>
More information about the llvm-commits
mailing list