public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
@ 2014-12-31  0:02 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-31  0:02 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got).
@ 2015-01-15 13:03 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2015-01-15 13:03 UTC (permalink / raw)
  To: elfutils-devel

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

On Wed, 2014-12-31 at 01:02 +0100, Mark Wielaard wrote:
> Found with afl-fuzz.
> 
> Signed-off-by: Mark Wielaard <mjw@redhat.com>

> +2014-12-30  Mark Wielaard  <mjw@redhat.com>
> +
> +	* ppc_symbol.c (find_dyn_got): Check sh_entsize is not zero.

I pushed this to master.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15 13:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-31  0:02 [PATCH] backends: Check sh_entsize is not zero in ppc_symbol.c (find_dyn_got) Mark Wielaard
2015-01-15 13:03 Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).