libdwfl: Don't trust e_shentsize in dwfl_segment_report_module
authorMark Wielaard <mark@klomp.org>
Wed, 8 Dec 2021 21:20:17 +0000 (22:20 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 9 Dec 2021 18:34:19 +0000 (19:34 +0100)
commitb9ed67836b6f4e580927b4e8e1c8517e70a086be
treee32b2605512c7c9db3d26a1d52269a8a856aa0ae
parentc21c606602e1160c19d01e2836e23aa1a9e13432
libdwfl: Don't trust e_shentsize in dwfl_segment_report_module

When calulating the possible section header table end us the actual size
of the section headers (sizeof (Elf32_Shdr) or sizeof (Elf64_Shdr)),
not the ELF header e_shentsize value, which can be corrupted. This
prevents a posssible overflow, but we check the shdrs_end is sane
later anyway.

https://sourceware.org/bugzilla/show_bug.cgi?id=28659

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