public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] libelf: Make sure n * w doesn't overflow in elf_getarsym.
@ 2014-12-09 12:44 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-09 12:44 UTC (permalink / raw)
  To: elfutils-devel

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

Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
 libelf/ChangeLog      | 4 ++++
 libelf/elf_getarsym.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index e03ee09..4860530 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-09  Mark Wielaard  <mjw@redhat.com>
+
+	* elf_getarsym.c (elf_getarsym): Make sure n * w doesn't overflow.
+
 2014-11-27  Mark Wielaard  <mjw@redhat.com>
 
 	* Makefile.am (libelf.so): Use textrel_check.
diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
index 7325190..ba88aa0 100644
--- a/libelf/elf_getarsym.c
+++ b/libelf/elf_getarsym.c
@@ -186,7 +186,7 @@ elf_getarsym (elf, ptr)
 #if SIZE_MAX <= 4294967295U
 	  || n >= SIZE_MAX / sizeof (Elf_Arsym)
 #endif
-	  || n * w > index_size)
+	  || n > index_size / w)
 	{
 	  /* This index table cannot be right since it does not fit into
 	     the file.  */
-- 
1.8.3.1


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

* Re: [PATCH] libelf: Make sure n * w doesn't overflow in elf_getarsym.
@ 2014-12-12 12:12 Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2014-12-12 12:12 UTC (permalink / raw)
  To: elfutils-devel

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

On Tue, 2014-12-09 at 13:44 +0100, Mark Wielaard wrote:
> +2014-12-09  Mark Wielaard  <mjw@redhat.com>
> +
> +	* elf_getarsym.c (elf_getarsym): Make sure n * w doesn't overflow.

Pushed to master.

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

end of thread, other threads:[~2014-12-12 12:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 12:44 [PATCH] libelf: Make sure n * w doesn't overflow in elf_getarsym Mark Wielaard
2014-12-12 12:12 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).