]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/elfcode.h
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>
Mon, 7 Dec 2015 03:12:23 +0000 (13:42 +1030)
commitc20f6f63eda61348326a861a155716b8d9073307
treea4d1423c4858d8807105ab85a8126f0ed2c7844d
parent549dba71045c856f3d169bf2edc7bfc7cabe5a0b
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.

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