diff options
author | Jim Ingham <jingham@apple.com> | 2019-03-12 19:27:39 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2019-03-12 19:27:39 +0000 |
commit | 027bf7603fc76ee6acabb4aa0e6e62275a3c498a (patch) | |
tree | 65e5559e155146a6b6ad03ef8ccf5b48ef82684b /lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | |
parent | 2ca0ebf6b4320affcc12bf9bce61d3ddcb0baa0d (diff) | |
download | bcm5719-llvm-027bf7603fc76ee6acabb4aa0e6e62275a3c498a.tar.gz bcm5719-llvm-027bf7603fc76ee6acabb4aa0e6e62275a3c498a.zip |
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.
<rdar://problem/48503320>
llvm-svn: 355957
Diffstat (limited to 'lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp')
-rw-r--r-- | lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp index d375cc2683e..f5281f2ce53 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp @@ -384,7 +384,7 @@ lldb::ValueObjectSP ListFrontEnd::GetChildAtIndex(size_t idx) { 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::GetChildAtIndex(size_t idx) { 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 |