libdwfl: Make sure we know the phdr entry size before searching phdrs.
Commit Message
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 <mark@klomp.org>
---
libdwfl/ChangeLog | 4 ++++
libdwfl/link_map.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
@@ -1,3 +1,7 @@
+2021-12-08 Mark Wielaard <mark@klomp.org>
+
+ * link_map.c (dwfl_link_map_report): Make sure phent != 0.
+
2021-12-08 Mark Wielaard <mark@klomp.org>
* link_map.c (dwfl_link_map_report): Limit malloc size to max
@@ -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);