Author: labath Date: Fri Jun 29 03:27:18 2018 New Revision: 335960 URL: http://llvm.org/viewvc/llvm-project?rev=335960&view=rev Log: 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. Modified: lldb/trunk/source/Commands/CommandCompletions.cpp Modified: lldb/trunk/source/Commands/CommandCompletions.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=335960&r1=335959&r2=335960&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandCompletions.cpp (original) +++ lldb/trunk/source/Commands/CommandCompletions.cpp Fri Jun 29 03:27:18 2018 @@ -164,7 +164,7 @@ static int DiskFilesOrDirectories(const // 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()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits