From: Nick Clifton Date: Thu, 10 Aug 2017 08:37:36 +0000 (+0100) Subject: Fix out of bounds memory access when trying to allocate space for a note of size -1. X-Git-Tag: users/ARM/embedded-binutils-master-2017q4~1417 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=957e1fc1c5d0262e4b2f764cf031ad1458446498;p=external%2Fbinutils.git 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 --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)