summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandCompletions.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-29 10:27:18 +0000
committerPavel Labath <labath@google.com>2018-06-29 10:27:18 +0000
commit88ec2e4ee73a0fc9770f3c7c7de87415eb6bae78 (patch)
treebc97081b7e6d44321bad4b969b7a44bdca79fa5c /lldb/source/Commands/CommandCompletions.cpp
parent1f6ad1466161a33fc3918689b2f001ef561bcee4 (diff)
downloadbcm5719-llvm-88ec2e4ee73a0fc9770f3c7c7de87415eb6bae78.tar.gz
bcm5719-llvm-88ec2e4ee73a0fc9770f3c7c7de87415eb6bae78.zip
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
Diffstat (limited to 'lldb/source/Commands/CommandCompletions.cpp')
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index dbb0b7e9469..f83a06d6748 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -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());
OpenPOWER on IntegriCloud