]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
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 96251f0de8ffa1314f5e55db31ad50d422804c98..d875eabd21e01ef7980e3e081883899ddc5b6e40 100644 (file)
@@ -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
index 1c298a8eab73deef7b6cee24936230275bd3ac4c..623b30620feea6aa087f214219970453c4432e0d 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);