]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
PR19323 memory allocation greater than 4G
authorAlan Modra <amodra@gmail.com>
Mon, 7 Dec 2015 03:11:36 +0000 (13:41 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 10 Dec 2015 13:48:49 +0000 (00:18 +1030)
commitaa8b89e8ae35f71a94a1eaee0da939396d2f61d4
tree928465cd61a77fc7109f5bc3a05e785dae922b19
parent02d0ca324cd810ffb6efd39ad7320c3504506c23
PR19323 memory allocation greater than 4G

On 32-bit targets, memory requested for program/section headers on a
fuzzed binary can wrap to 0.  A bfd_alloc of zero bytes actually
returns a one byte allocation rather than a NULL pointer.  This then
leads to buffer overflows.

Making this check unconditional triggers an extremely annoying gcc-5
warning.

PR 19323
* elfcode.h (elf_object_p): Check for ridiculous e_shnum and
e_phnum values.
bfd/ChangeLog
bfd/elfcode.h