[PATCH] D34554: [ELF] FIx use-after-return of archive path
Eugene Leviant via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 23 06:05:17 PDT 2017
evgeny777 created this revision.
evgeny777 added a project: lld.
Herald added a subscriber: emaste.
There is a bug in lld which on some occasions causes InputFile::ArchiveName to store incorrect value. This happens because library name allocated on stack then converted to StringRef and assigned to member variable.
Repository:
rL LLVM
https://reviews.llvm.org/D34554
Files:
ELF/Driver.cpp
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -225,7 +225,7 @@
// Add a given library by searching it from input search paths.
void LinkerDriver::addLibrary(StringRef Name) {
if (Optional<std::string> Path = searchLibrary(Name))
- addFile(*Path, /*WithLOption=*/true);
+ addFile(Saver.save(*Path), /*WithLOption=*/true);
else
error("unable to find library -l" + Name);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34554.103723.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170623/14be2419/attachment.bin>
More information about the llvm-commits
mailing list