[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
Thu Apr 19 13:30:04 PDT 2018
inglorion updated this revision to Diff 143157.
inglorion added a comment.
@ruiu, how about this?
https://reviews.llvm.org/D45789
Files:
lld/COFF/Chunks.cpp
Index: lld/COFF/Chunks.cpp
===================================================================
--- lld/COFF/Chunks.cpp
+++ lld/COFF/Chunks.cpp
@@ -271,6 +271,10 @@
return;
// Copy section contents from source object file to output file.
ArrayRef<uint8_t> A = getContents();
+ if (A.empty()) {
+ assert(Relocs.empty() && "Empty section should not have relocations");
+ return;
+ }
memcpy(Buf + OutputSectionOff, A.data(), A.size());
// Apply relocations.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45789.143157.patch
Type: text/x-patch
Size: 481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/f37a882b/attachment.bin>
More information about the llvm-commits
mailing list