Fix a bug where passing a value of the type "A B" to settings set target.env-vars would cause LLDB to crash
Fixes rdar://problem/21241817
llvm-svn: 239766
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index a209a69..d204547 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -117,6 +117,12 @@
llvm::StringRef key_and_value(args.GetArgumentAtIndex(i));
if (!key_and_value.empty())
{
+ if (key_and_value.find('=') == llvm::StringRef::npos)
+ {
+ error.SetErrorString("assign operation takes one or more key=value arguments");
+ return error;
+ }
+
std::pair<llvm::StringRef, llvm::StringRef> kvp(key_and_value.split('='));
llvm::StringRef key = kvp.first;
bool key_valid = false;