[binutils-gdb/binutils-2_29-branch] Check for an invalid note size when parsing ELF notes.
Nick Clifton
nickc@sourceware.org
Fri Sep 1 09:17:00 GMT 2017
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=30326b094b8fc2594c76cf4beab70965afa7a111
commit 30326b094b8fc2594c76cf4beab70965afa7a111
Author: Nick Clifton <nickc@redhat.com>
Date: Fri Sep 1 10:17:00 2017 +0100
Check for an invalid note size when parsing ELF notes.
PR 21933
PR 22060
* elf.c (elf_read_notes): Check for a note size of -1.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/elf.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e9ea6cf..8db7080 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2017-09-01 Nick Clifton <nickc@redhat.com>
+ PR 21933
+ PR 22060
+ * elf.c (elf_read_notes): Check for a note size of -1.
+
+2017-09-01 Nick Clifton <nickc@redhat.com>
+
PR 22058
* elf-attrs.c (_bfd_elf_parse_attributes): Ensure that the
attribute buffer is NUL terminated.
diff --git a/bfd/elf.c b/bfd/elf.c
index 063a6e4..fbf639b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10976,7 +10976,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