Skip to content

Commit 7c64093

Browse files
committed
Switch Windows search path options to std::string
A CompilerInvocation object may outlive the input argument list, so we need to copy these argument strings to avoid a use-after-free
1 parent b376408 commit 7c64093

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/swift/AST/SearchPathOptions.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ class SearchPathOptions {
372372
FrameworkSearchPaths.size() - 1);
373373
}
374374

375-
std::optional<StringRef> WinSDKRoot = std::nullopt;
376-
std::optional<StringRef> WinSDKVersion = std::nullopt;
377-
std::optional<StringRef> VCToolsRoot = std::nullopt;
378-
std::optional<StringRef> VCToolsVersion = std::nullopt;
375+
std::optional<std::string> WinSDKRoot = std::nullopt;
376+
std::optional<std::string> WinSDKVersion = std::nullopt;
377+
std::optional<std::string> VCToolsRoot = std::nullopt;
378+
std::optional<std::string> VCToolsVersion = std::nullopt;
379379

380380
public:
381381
StringRef getSDKPath() const { return SDKPath; }

0 commit comments

Comments
 (0)