[Lldb-commits] [lldb] 6700f4b - [LLDB] Add checks for ValueObjectSP in Cocoa summary providers

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 29 14:47:36 PDT 2020


Author: shafik
Date: 2020-07-29T14:47:18-07:00
New Revision: 6700f4b9fe6321ef704efa4890af5bc351a124f0

URL: https://github.com/llvm/llvm-project/commit/6700f4b9fe6321ef704efa4890af5bc351a124f0
DIFF: https://github.com/llvm/llvm-project/commit/6700f4b9fe6321ef704efa4890af5bc351a124f0.diff

LOG: [LLDB] Add checks for ValueObjectSP in Cocoa summary providers

We saw a crash recently (rdar://problem/65276489) that looks related to an invalid ValueObjectSP in a summary providers in Cocoa.cpp e.g. NSBundleSummaryProvider(...).
This adds checks before we use them usually by calling NSStringSummaryProvider.

Differential Revision: https://reviews.llvm.org/D84272

Added: 
    

Modified: 
    lldb/source/Plugins/Language/ObjC/Cocoa.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
index 648fc4adf24f..ca4f7332f258 100644
--- a/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
+++ b/lldb/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -72,6 +72,9 @@ bool lldb_private::formatters::NSBundleSummaryProvider(
         valobj.GetCompilerType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID),
         true));
 
+    if (!text)
+      return false;
+
     StreamString summary_stream;
     bool was_nsstring_ok =
         NSStringSummaryProvider(*text, summary_stream, options);
@@ -117,6 +120,10 @@ bool lldb_private::formatters::NSTimeZoneSummaryProvider(
     uint64_t offset = ptr_size;
     ValueObjectSP text(valobj.GetSyntheticChildAtOffset(
         offset, valobj.GetCompilerType(), true));
+
+    if (!text)
+      return false;
+
     StreamString summary_stream;
     bool was_nsstring_ok =
         NSStringSummaryProvider(*text, summary_stream, options);
@@ -162,6 +169,10 @@ bool lldb_private::formatters::NSNotificationSummaryProvider(
     uint64_t offset = ptr_size;
     ValueObjectSP text(valobj.GetSyntheticChildAtOffset(
         offset, valobj.GetCompilerType(), true));
+
+    if (!text)
+      return false;
+
     StreamString summary_stream;
     bool was_nsstring_ok =
         NSStringSummaryProvider(*text, summary_stream, options);


        


More information about the lldb-commits mailing list