From: Mark Wielaard Date: Wed, 8 Dec 2021 19:48:45 +0000 (+0100) Subject: libdwfl: Make sure we know the phdr entry size before searching phdrs. X-Git-Tag: elfutils-0.187~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c21c606602e1160c19d01e2836e23aa1a9e13432;p=thirdparty%2Felfutils.git libdwfl: Make sure we know the phdr entry size before searching phdrs. Without the program header entry size we cannot search through the phdrs. https://sourceware.org/bugzilla/show_bug.cgi?id=28657 Signed-off-by: Mark Wielaard --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 96251f0de..d875eabd2 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,7 @@ +2021-12-08 Mark Wielaard + + * link_map.c (dwfl_link_map_report): Make sure phent != 0. + 2021-12-08 Mark Wielaard * link_map.c (dwfl_link_map_report): Limit malloc size to max diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index 1c298a8ea..623b30620 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -784,7 +784,7 @@ dwfl_link_map_report (Dwfl *dwfl, const void *auxv, size_t auxv_size, GElf_Xword dyn_filesz = 0; GElf_Addr dyn_bias = (GElf_Addr) -1; - if (phdr != 0 && phnum != 0) + if (phdr != 0 && phnum != 0 && phent != 0) { Dwfl_Module *phdr_mod; int phdr_segndx = INTUSE(dwfl_addrsegment) (dwfl, phdr, &phdr_mod);