[Lldb-commits] [lldb] r280513 - Check for null
Enrico Granata via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 2 11:15:48 PDT 2016
Author: enrico
Date: Fri Sep 2 13:15:48 2016
New Revision: 280513
URL: http://llvm.org/viewvc/llvm-project?rev=280513&view=rev
Log:
Check for null
Modified:
lldb/trunk/source/Core/ValueObject.cpp
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=280513&r1=280512&r2=280513&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Sep 2 13:15:48 2016
@@ -1251,6 +1251,13 @@ ValueObject::ReadPointedString (lldb::Da
if (cstr_address_type == eAddressTypeHost && is_array)
{
const char* cstr = GetDataExtractor().PeekCStr(0);
+ if (cstr == nullptr)
+ {
+ s << "<invalid address>";
+ error.SetErrorString("invalid address");
+ CopyStringDataToBufferSP(s, buffer_sp);
+ return {0,was_capped};
+ }
buffer_sp.reset(new DataBufferHeap(cstr_len, 0));
memcpy(buffer_sp->GetBytes(), cstr, cstr_len);
return {cstr_len,was_capped};
More information about the lldb-commits
mailing list