Skip to content

Commit 38b1da3

Browse files
committed
Patch Out Use-Of-Stack-After-Free In Cross Module Dependencies
The fake job is entered into the map to satisfy the tracing machinery. When that same machinery kicks into gear to print out paths, lookups into the dictionary will access data has gone out of scope. For now, cut off the read. There will be another refactoring patch that keeps these temporaries out of the Driver's data structures entirely. rdar://70053563
1 parent 171e0e2 commit 38b1da3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Driver/FineGrainedDependencyDriverGraph.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,11 @@ StringRef ModuleDepGraph::getProvidingFilename(
752752
const Optional<std::string> swiftDeps) const {
753753
if (!swiftDeps)
754754
return "<unknown";
755+
auto ext = llvm::sys::path::extension(*swiftDeps);
756+
if (file_types::lookupTypeForExtension(ext) ==
757+
file_types::TY_SwiftModuleFile) {
758+
return *swiftDeps;
759+
}
755760
const StringRef inputName =
756761
llvm::sys::path::filename(getJob(swiftDeps)->getFirstSwiftPrimaryInput());
757762
// FineGrainedDependencyGraphTests work with simulated jobs with empty

0 commit comments

Comments
 (0)