[llvm] r373683 - [dsymutil] Fix stack-use-after-scope
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 17:39:48 PDT 2019
Author: jdevlieghere
Date: Thu Oct 3 17:39:48 2019
New Revision: 373683
URL: http://llvm.org/viewvc/llvm-project?rev=373683&view=rev
Log:
[dsymutil] Fix stack-use-after-scope
The lambda is taking the stack-allocated Verify boolean by reference and
it would go out of scope on the next iteration. Moving it out of the
loop should fix the issue.
Fixes https://bugs.llvm.org/show_bug.cgi?id=43549
Modified:
llvm/trunk/tools/dsymutil/dsymutil.cpp
Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=373683&r1=373682&r2=373683&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Thu Oct 3 17:39:48 2019
@@ -520,9 +520,10 @@ int main(int argc, char **argv) {
// If there is more than one link to execute, we need to generate
// temporary files.
- bool NeedsTempFiles =
+ const bool NeedsTempFiles =
!Options.DumpDebugMap && (Options.OutputFile != "-") &&
(DebugMapPtrsOrErr->size() != 1 || Options.LinkOpts.Update);
+ const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput;
SmallVector<MachOUtils::ArchAndFile, 4> TempFiles;
std::atomic_char AllOK(1);
@@ -577,7 +578,6 @@ int main(int argc, char **argv) {
}
}
- const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput;
auto LinkLambda = [&, OutputFile](std::shared_ptr<raw_fd_ostream> Stream,
LinkOptions Options) {
AllOK.fetch_and(
More information about the llvm-commits
mailing list