Skip to content

Commit b68d9fe

Browse files
authored
Merge pull request swiftlang#31051 from benlangmuir/use-after-free-string
[sourcekit] Fix use-after-free of request string
2 parents 6ea4b5e + 8303289 commit b68d9fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ class CursorRangeInfoConsumer : public SwiftASTConsumer {
11621162
protected:
11631163
SwiftLangSupport ⟪
11641164
SwiftInvocationRef ASTInvok;
1165-
StringRef InputFile;
1165+
std::string InputFile;
11661166
unsigned Offset;
11671167
unsigned Length;
11681168

@@ -1181,7 +1181,7 @@ class CursorRangeInfoConsumer : public SwiftASTConsumer {
11811181
CursorRangeInfoConsumer(StringRef InputFile, unsigned Offset, unsigned Length,
11821182
SwiftLangSupport &Lang, SwiftInvocationRef ASTInvok,
11831183
bool TryExistingAST, bool CancelOnSubsequentRequest)
1184-
: Lang(Lang), ASTInvok(ASTInvok),InputFile(InputFile), Offset(Offset),
1184+
: Lang(Lang), ASTInvok(ASTInvok),InputFile(InputFile.str()), Offset(Offset),
11851185
Length(Length), TryExistingAST(TryExistingAST),
11861186
CancelOnSubsequentRequest(CancelOnSubsequentRequest) {}
11871187

0 commit comments

Comments
 (0)