[Lldb-commits] [lldb] r355957 - Check the result of creating a node from __next_ in the std::list formatter.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 12 12:27:40 PDT 2019

Author: jingham
Date: Tue Mar 12 12:27:39 2019
New Revision: 355957

URL: http://llvm.org/viewvc/llvm-project?rev=355957&view=rev
Check the result of creating a node from __next_ in the std::list formatter.

There's a single report of a crash coming from this current_sp being NULL.  I don't
have a repro case, and I couldn't get it to happen by hand-corrupting a list.  We
always get an error instead.  So I don't have a test case.  But checking for null
is clearly right here.



Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp?rev=355957&r1=355956&r2=355957&view=diff
--- lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxList.cpp Tue Mar 12 12:27:39 2019
@@ -384,7 +384,7 @@ lldb::ValueObjectSP ListFrontEnd::GetChi
   if (current_sp->GetName() == g_next) {
     ProcessSP process_sp(current_sp->GetProcessSP());
     if (!process_sp)
-      return nullptr;
+      return lldb::ValueObjectSP();
     // if we grabbed the __next_ pointer, then the child is one pointer deep-er
     lldb::addr_t addr = current_sp->GetParent()->GetPointerValue();
@@ -392,6 +392,8 @@ lldb::ValueObjectSP ListFrontEnd::GetChi
     ExecutionContext exe_ctx(process_sp);
     current_sp =
         CreateValueObjectFromAddress("__value_", addr, exe_ctx, m_element_type);
+    if (!current_sp)
+      return lldb::ValueObjectSP();
   // we need to copy current_sp into a new object otherwise we will end up with

More information about the lldb-commits mailing list