[PATCH] [lld] Fix use-after-free bug identified by the Address Sanitizer

Greg Fitzgerald garious at gmail.com
Wed Feb 18 13:56:46 PST 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D7732

Files:
  lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp

Index: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
===================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@ -985,12 +985,10 @@
   if (sxdata.empty())
     return std::error_code();
 
-  std::vector<uint8_t> atomContent =
-      *new (_alloc) std::vector<uint8_t>((size_t)sxdata.size());
   auto *atom = new (_alloc) COFFDefinedAtom(
       *this, "", ".sxdata", Atom::scopeTranslationUnit, DefinedAtom::typeData,
       false /*isComdat*/, DefinedAtom::permR__, DefinedAtom::mergeNo,
-      atomContent, _ordinal++);
+      sxdata, _ordinal++);
 
   const ulittle32_t *symbolIndex =
       reinterpret_cast<const ulittle32_t *>(sxdata.data());

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7732.20219.patch
Type: text/x-patch
Size: 769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150218/baba487f/attachment.bin>


More information about the llvm-commits mailing list