libdwfl: Make sure we know the phdr entry size before searching phdrs.
authorMark Wielaard <mark@klomp.org>
Wed, 8 Dec 2021 19:48:45 +0000 (20:48 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 9 Dec 2021 18:34:19 +0000 (19:34 +0100)
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
libdwfl/link_map.c

index 96251f0..d875eab 100644 (file)
@@ -1,5 +1,9 @@
 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
        possible. When converting make sure we don't exceed the number
        of bytes available in either in.d_buf nor out.d_buf.
index 1c298a8..623b306 100644 (file)
@@ -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);