aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-08-10 09:37:36 +0100
committerNick Clifton <nickc@redhat.com>2017-08-10 09:37:36 +0100
commit957e1fc1c5d0262e4b2f764cf031ad1458446498 (patch)
treef506930d1d7c9475ac2920c8b4d54c1315f80189 /bfd
parent3ecaa9fd728f6dd23de85efa0ceacf40da444c86 (diff)
downloadgdb-957e1fc1c5d0262e4b2f764cf031ad1458446498.zip
gdb-957e1fc1c5d0262e4b2f764cf031ad1458446498.tar.gz
gdb-957e1fc1c5d0262e4b2f764cf031ad1458446498.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf.c2
1 files changed, 1 insertions, 1 deletions
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)