diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-01 23:37:33 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-08-01 23:37:33 +0000 |
commit | f93d162e335320c5c33f7ae9f6cc94cce2494f6d (patch) | |
tree | 0c6fad8fc17f19c1753f0610fbd39a4ce3767980 /llvm/tools | |
parent | 2264f96c2a3b5db3df1a33b15cc32f1797d47d2d (diff) | |
download | bcm5719-llvm-f93d162e335320c5c33f7ae9f6cc94cce2494f6d.tar.gz bcm5719-llvm-f93d162e335320c5c33f7ae9f6cc94cce2494f6d.zip |
[dsymutil] Fix heap-use-after-free related to the LinkOptions.
In r367348, I changed dsymutil to pass the LinkOptions by value isntead
of by const reference. However, the options were still captured by
reference in the LinkLambda. This patch fixes that by passing them in by
value.
llvm-svn: 367635
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/dsymutil/dsymutil.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index 60ba1432554..759b5e4e26c 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -591,9 +591,10 @@ int main(int argc, char **argv) { } } - auto LinkLambda = [&, - OutputFile](std::shared_ptr<raw_fd_ostream> Stream) { - AllOK.fetch_and(linkDwarf(*Stream, BinHolder, *Map, *OptionsOrErr)); + auto LinkLambda = [&, OutputFile](std::shared_ptr<raw_fd_ostream> Stream, + LinkOptions Options) { + AllOK.fetch_and( + linkDwarf(*Stream, BinHolder, *Map, std::move(Options))); Stream->flush(); if (Verify && !NoOutput) AllOK.fetch_and(verify(OutputFile, Map->getTriple().getArchName())); @@ -603,9 +604,9 @@ int main(int argc, char **argv) { // out the (significantly smaller) stack when using threads. We don't // want this limitation when we only have a single thread. if (ThreadCount == 1) - LinkLambda(OS); + LinkLambda(OS, *OptionsOrErr); else - Threads.async(LinkLambda, OS); + Threads.async(LinkLambda, OS, *OptionsOrErr); } Threads.wait(); |