mirror of
https://github.com/openharmony/third_party_elfutils.git
synced 2026-07-19 19:43:34 -04:00
getcfi_scn_eh_frame: Don't crash and burn when .eh_frame bits aren't there.
Trying to read non-existing bits sometimes works and normally a sanity check will fail. But it could also lead to an unexpected crash much later when trying to use the non-existing data. Signed-off-by: Mark Wielaard <mjw@redhat.com>
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2013-07-02 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* dwarf_getcfi_elf.c (getcfi_shdr): Check sh_type == SHT_PROGBITS.
|
||||
|
||||
2013-06-26 Mark Wielaard <mjw@redhat.com>
|
||||
|
||||
* libdw_visit_scopes.c (__libdw_visit_scopes): Don't reject root
|
||||
|
||||
@@ -280,8 +280,13 @@ getcfi_shdr (Elf *elf, const GElf_Ehdr *ehdr)
|
||||
hdr_vaddr = shdr->sh_addr;
|
||||
}
|
||||
else if (!strcmp (name, ".eh_frame"))
|
||||
return getcfi_scn_eh_frame (elf, ehdr, scn, shdr,
|
||||
hdr_scn, hdr_vaddr);
|
||||
{
|
||||
if (shdr->sh_type == SHT_PROGBITS)
|
||||
return getcfi_scn_eh_frame (elf, ehdr, scn, shdr,
|
||||
hdr_scn, hdr_vaddr);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user