Skip to content

Commit 016f6f6

Browse files
committed
[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 llvm-svn: 373683
1 parent 57b6536 commit 016f6f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/tools/dsymutil/dsymutil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,10 @@ int main(int argc, char **argv) {
520520

521521
// If there is more than one link to execute, we need to generate
522522
// temporary files.
523-
bool NeedsTempFiles =
523+
const bool NeedsTempFiles =
524524
!Options.DumpDebugMap && (Options.OutputFile != "-") &&
525525
(DebugMapPtrsOrErr->size() != 1 || Options.LinkOpts.Update);
526+
const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput;
526527

527528
SmallVector<MachOUtils::ArchAndFile, 4> TempFiles;
528529
std::atomic_char AllOK(1);
@@ -577,7 +578,6 @@ int main(int argc, char **argv) {
577578
}
578579
}
579580

580-
const bool Verify = Options.Verify && !Options.LinkOpts.NoOutput;
581581
auto LinkLambda = [&, OutputFile](std::shared_ptr<raw_fd_ostream> Stream,
582582
LinkOptions Options) {
583583
AllOK.fetch_and(

0 commit comments

Comments
 (0)