From 64c034da2b422b9ef2772441644e087f2d4c44ac Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Mon, 23 May 2016 17:11:14 +0000 Subject: [PATCH] =?UTF-8?q?SBValue::CreateValueFromData=20didn=E2=80=99t?= =?UTF-8?q?=20check=20whether=20the=20SBType=20passed=20into=20it=20is=20i?= =?UTF-8?q?n=20fact=20a=20valid=20type=20-=20this=20can=20lead=20to=20LLDB?= =?UTF-8?q?=20crashing=20upon=20access?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Committing on behalf of Sebastian Theophil llvm-svn: 270456 --- lldb/source/API/SBValue.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 383d39f53681..a93cd8d55465 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -922,16 +922,17 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s } lldb::SBValue -SBValue::CreateValueFromData (const char* name, SBData data, SBType type) +SBValue::CreateValueFromData (const char* name, SBData data, SBType sb_type) { lldb::SBValue sb_value; lldb::ValueObjectSP new_value_sp; ValueLocker locker; lldb::ValueObjectSP value_sp(GetSP(locker)); - if (value_sp) + lldb::TypeImplSP type_impl_sp (sb_type.GetSP()); + if (value_sp && type_impl_sp) { ExecutionContext exe_ctx (value_sp->GetExecutionContextRef()); - new_value_sp = ValueObject::CreateValueObjectFromData(name, **data, exe_ctx, type.GetSP()->GetCompilerType(true)); + new_value_sp = ValueObject::CreateValueObjectFromData(name, **data, exe_ctx, type_impl_sp->GetCompilerType(true)); new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad); } sb_value.SetSP(new_value_sp);