dwarf-reader: handle symtab.section_header.sh_entsize == 0
authorMatthias Maennich <maennich@google.com>
Fri, 24 Jan 2020 22:45:56 +0000 (22:45 +0000)
committerMatthias Maennich <maennich@google.com>
Fri, 24 Jan 2020 22:53:30 +0000 (22:53 +0000)
commit4252dfd6c5e0a2d1fd7d20d886aabe4085d8b807
tree99938a3fd25c4a6defddac8798828badf30a7ca6
parent06fef190000ab74d2770680be54687a9e1198dd7
dwarf-reader: handle symtab.section_header.sh_entsize == 0

A broken elf file with a sh_entsize of 0 makes the dwarf reader crash
due to a division by zero. Fix this by validating the input and exiting
early in that case.

* src/abg-dwarf-reader.cc (load_symbol_maps_from_symtab_section):
Handle elf file with invalid sh_entsize.
* tests/test-read-dwarf.cc (test_task::perform): handle empty
in_abi_path and out_abi_path as 'read only' test.
(InOutSpec): add test case.
* tests/data/test-read-dwarf/test25-bogus-binary.elf: new test data.

Signed-off-by: Matthias Maennich <maennich@google.com>
src/abg-dwarf-reader.cc
tests/data/test-read-dwarf/test25-bogus-binary.elf [new file with mode: 0644]
tests/test-read-dwarf.cc