mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-14 22:14:35 +00:00
dwarf-reader: handle binaries with missing symtab
A broken elf file might not have a valid symtab. As of now we would hit an ABG_ASSERT and crash. Let's catch that case and bail out instead. * src/abg-dwarf-reader.cc (load_symbol_maps_from_symtab_section): Handle elf file with missing symtab. * tests/test-read-dwarf.cc (InOutSpec): add test case. * tests/data/test-read-dwarf/test26-bogus-binary.elf: new test data. Signed-off-by: Matthias Maennich <maennich@google.com>
This commit is contained in:
parent
4252dfd6c5
commit
4457c10eec
@ -7396,7 +7396,8 @@ public:
|
||||
size_t nb_syms = symtab_sheader->sh_size / symtab_sheader->sh_entsize;
|
||||
|
||||
Elf_Data* symtab = elf_getdata(symtab_section, 0);
|
||||
ABG_ASSERT(symtab);
|
||||
if (!symtab)
|
||||
return false;
|
||||
|
||||
GElf_Ehdr elf_header;
|
||||
ABG_ASSERT(gelf_getehdr(elf_handle(), &elf_header));
|
||||
|
BIN
tests/data/test-read-dwarf/test26-bogus-binary.elf
Normal file
BIN
tests/data/test-read-dwarf/test26-bogus-binary.elf
Normal file
Binary file not shown.
@ -259,6 +259,12 @@ InOutSpec in_out_specs[] =
|
||||
"",
|
||||
"",
|
||||
},
|
||||
{
|
||||
"data/test-read-dwarf/test26-bogus-binary.elf",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
},
|
||||
// This should be the last entry.
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user