]> git.ipfire.org Git - thirdparty/elfutils.git/commit
readelf: Fix crash on reading loc data or range data with bad/no CUs.
authorMark Wielaard <mark@klomp.org>
Thu, 25 Jan 2018 12:24:19 +0000 (13:24 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 25 Jan 2018 12:58:26 +0000 (13:58 +0100)
commite98f032d293a8ea8ea2b25949d7f452603e644d9
tree4d6d4f1f405678affff86b4940d88b9d43e3b24c
parent1e2c886bb2e1e48dfc592f356ecad7da0a032f0a
readelf: Fix crash on reading loc data or range data with bad/no CUs.

In print_debug_ranges_section and print_debug_loc_section we try to
get the associated CU through skip_listptr_hole for the first data data.
If no CU at all can be found (because the .debug_info section was bogus)
this would keep the Dwarf_CU uninitialized causing a crash later on
when it was compared to the last_cu and used because it was unequal.
Fix this by explicitly initializing cu to last_cu (which is NULL on
first use).

Signed-off-by: Mark Wielaard <mark@klomp.org>
src/ChangeLog
src/readelf.c