Author: Med Ismail Bennani
Date: 2022-08-11T22:29:06-07:00
New Revision: 6c58f12d07612a4d2bc9abdc5bb545cbb4810f0e

URL: 
https://github.com/llvm/llvm-project/commit/6c58f12d07612a4d2bc9abdc5bb545cbb4810f0e
DIFF: 
https://github.com/llvm/llvm-project/commit/6c58f12d07612a4d2bc9abdc5bb545cbb4810f0e.diff

LOG: [lldb/Symbol] Fix null-deref in TypeList::Dump

This patch should just a crash caused by a null pointer dereferencing
when dumping a type. It makes sure that the pointer is valid.

rdar://97455134

Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com>

Added: 
    

Modified: 
    lldb/source/Symbol/TypeList.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/TypeList.cpp b/lldb/source/Symbol/TypeList.cpp
index 494e59e3a0fc2..2e101e0a8f574 100644
--- a/lldb/source/Symbol/TypeList.cpp
+++ b/lldb/source/Symbol/TypeList.cpp
@@ -92,9 +92,9 @@ void TypeList::ForEach(
 }
 
 void TypeList::Dump(Stream *s, bool show_context) {
-  for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos) 
{
-    pos->get()->Dump(s, show_context);
-  }
+  for (iterator pos = m_types.begin(), end = m_types.end(); pos != end; ++pos)
+    if (Type *t = pos->get())
+      t->Dump(s, show_context);
 }
 
 void TypeList::RemoveMismatchedTypes(llvm::StringRef qualified_typename,


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to