]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
authorMark Wielaard <mjw@redhat.com>
Tue, 30 Dec 2014 23:40:02 +0000 (00:40 +0100)
committerMark Wielaard <mjw@redhat.com>
Thu, 15 Jan 2015 13:03:08 +0000 (14:03 +0100)
Found with afl-fuzz.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
backends/ChangeLog
backends/ppc_symbol.c

index e800d16bfccdb3793ef755d82ee821906c0dc824..57e1b8ee18f9d831a890170e94a8d23c7595ae1b 100644 (file)
@@ -1,3 +1,7 @@
+2014-12-30  Mark Wielaard  <mjw@redhat.com>
+
+       * ppc_symbol.c (find_dyn_got): Check sh_entsize is not zero.
+
 2014-12-18  Ulrich Drepper  <drepper@gmail.com>
 
        * Makefile.am: Suppress output of textrel_check command.
index c17ab37470624132902e1ede577cd9fd9b291fe2..733114b6a1b9c3c2d8731c330135cc1ae79b394f 100644 (file)
@@ -98,7 +98,8 @@ find_dyn_got (Elf *elf, GElf_Addr *addr)
       GElf_Shdr shdr_mem;
       GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
       Elf_Data *data = elf_getdata (scn, NULL);
-      if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL)
+      if (shdr != NULL && shdr->sh_type == SHT_DYNAMIC && data != NULL
+         && shdr->sh_entsize != 0)
        for (unsigned int j = 0; j < shdr->sh_size / shdr->sh_entsize; ++j)
          {
            GElf_Dyn dyn_mem;