[binutils-gdb] Fix out of bounds memory access when trying to allocate space for a note of size -1.
Nick Clifton
nickc@sourceware.org
Thu Aug 10 08:38:00 GMT 2017
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=957e1fc1c5d0262e4b2f764cf031ad1458446498
commit 957e1fc1c5d0262e4b2f764cf031ad1458446498
Author: Nick Clifton <nickc@redhat.com>
Date: Thu Aug 10 09:37:36 2017 +0100
Fix out of bounds memory access when trying to allocate space for a note of size -1.
PR 21933
* elf.c (elf_read_notes): Check for a note size of -1.
Diff:
---
bfd/elf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bfd/elf.c b/bfd/elf.c
index bc4b4a3..d702474 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10997,7 +10997,7 @@ elf_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size)
{
char *buf;
- if (size <= 0)
+ if (size == 0 || (size + 1) == 0)
return TRUE;
if (bfd_seek (abfd, offset, SEEK_SET) != 0)
More information about the Binutils-cvs
mailing list