<rdar://problem/10551280>

Fixed a crasher that can occur when parsing invalid DWARF.

llvm-svn: 147350
This commit is contained in:
Greg Clayton 2011-12-29 19:47:20 +00:00
parent e1bd05128e
commit 360f9a7663
2 changed files with 17 additions and 2 deletions

View File

@ -150,6 +150,12 @@ public:
const DWARFDebugAranges &
GetFunctionAranges ();
SymbolFileDWARF*
GetSymbolFileDWARF () const
{
return m_dwarf2Data;
}
protected:
SymbolFileDWARF* m_dwarf2Data;
const DWARFAbbreviationDeclarationSet *m_abbrevs;

View File

@ -124,11 +124,11 @@ DWARFDebugInfoEntry::FastExtract
m_parent_idx = 0;
m_sibling_idx = 0;
m_empty_children = false;
uint64_t abbr_idx = debug_info_data.GetULEB128 (offset_ptr);
const uint64_t abbr_idx = debug_info_data.GetULEB128 (offset_ptr);
assert (abbr_idx < (1 << DIE_ABBR_IDX_BITSIZE));
m_abbr_idx = abbr_idx;
assert (fixed_form_sizes); // For best performance this should be specified!
//assert (fixed_form_sizes); // For best performance this should be specified!
if (m_abbr_idx)
{
@ -136,6 +136,15 @@ DWARFDebugInfoEntry::FastExtract
const DWARFAbbreviationDeclaration *abbrevDecl = cu->GetAbbreviations()->GetAbbreviationDeclaration(m_abbr_idx);
if (abbrevDecl == NULL)
{
cu->GetSymbolFileDWARF ()->ReportError ("{0x%8.8x}: invalid abbreviation code %u, please file a bug and attach the file at the start of this error message",
m_offset,
(unsigned)abbr_idx);
// WE can't parse anymore if the DWARF is borked...
*offset_ptr = UINT32_MAX;
return false;
}
m_tag = abbrevDecl->Tag();
m_has_children = abbrevDecl->HasChildren();
// Skip all data in the .debug_info for the attributes