mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
Fix use-after-free in CommandCompletions.cpp
The code was creating a StringRef to a temporary std::string. The solution is to just drop the .str() from the original StringRef. This manifested it self as the new TestCompletions test failing in some configurations. llvm-svn: 335960
This commit is contained in:
@@ -164,7 +164,7 @@ static int DiskFilesOrDirectories(const llvm::Twine &partial_name,
|
||||
// search in the fully resolved directory, but CompletionBuffer keeps the
|
||||
// unmodified form that the user typed.
|
||||
Storage = Resolved;
|
||||
llvm::StringRef RemainderDir = path::parent_path(Remainder.str());
|
||||
llvm::StringRef RemainderDir = path::parent_path(Remainder);
|
||||
if (!RemainderDir.empty()) {
|
||||
// Append the remaining path to the resolved directory.
|
||||
Storage.append(path::get_separator());
|
||||
|
||||
Reference in New Issue
Block a user