[lld] r286880 - Fix heap-use-after-free coff::createPDB
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 12:21:42 PST 2016
Author: vitalybuka
Date: Mon Nov 14 14:21:41 2016
New Revision: 286880
URL: http://llvm.org/viewvc/llvm-project?rev=286880&view=rev
Log:
Fix heap-use-after-free coff::createPDB
Summary:
getInputSections returns std::vector by value and ArrayRef
pointed to destroyed temporarily.
Reviewers: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D26630
Modified:
lld/trunk/COFF/PDB.cpp
Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=286880&r1=286879&r2=286880&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Mon Nov 14 14:21:41 2016
@@ -82,9 +82,8 @@ void coff::createPDB(StringRef Path, Sym
IpiBuilder.setVersionHeader(pdb::PdbTpiV80);
// Add Section Contributions.
- ArrayRef<coff_section> InputSections = getInputSections(Symtab);
std::vector<pdb::SectionContrib> Contribs =
- pdb::DbiStreamBuilder::createSectionContribs(InputSections);
+ pdb::DbiStreamBuilder::createSectionContribs(getInputSections(Symtab));
DbiBuilder.setSectionContribs(Contribs);
// Add Section Map stream.
More information about the llvm-commits
mailing list