This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Wed, 31 Dec 2014 01:02:49 +0100
- Subject: [PATCH] backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
Found with afl-fuzz.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
backends/ChangeLog | 4 ++++
backends/ppc_symbol.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/backends/ChangeLog b/backends/ChangeLog
index e800d16..57e1b8e 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -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.
diff --git a/backends/ppc_symbol.c b/backends/ppc_symbol.c
index c17ab37..733114b 100644
--- a/backends/ppc_symbol.c
+++ b/backends/ppc_symbol.c
@@ -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;
--
2.1.0