SBValue::CreateValueFromData didn’t check whether the SBType passed into it is in fact a valid type - this can lead to LLDB crashing upon access

Committing on behalf of Sebastian Theophil

llvm-svn: 270456
This commit is contained in:
Enrico Granata 2016-05-23 17:11:14 +00:00
parent b91bf1a9a0
commit 64c034da2b
1 changed files with 4 additions and 3 deletions

View File

@ -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);