PR26011, excessive memory allocation with fuzzed reloc sections
authorAlan Modra <amodra@gmail.com>
Tue, 19 May 2020 22:25:56 +0000 (07:55 +0930)
committerAlan Modra <amodra@gmail.com>
Tue, 19 May 2020 22:29:15 +0000 (07:59 +0930)
commit3c568b8afab512d12eb5adcf304e505b1bce644d
treeee5f7e9f4f5a438c803192e2ca709f7f6cde825f
parentc7e976792002c6a2810f9bb6cc3ad210514eb650
PR26011, excessive memory allocation with fuzzed reloc sections

Check sizes early, before users of slurp_relocs allocate buffers for
the swapped in relocs.

PR 26011
* elf.c (_bfd_elf_get_reloc_upper_bound): Sanity check reloc
section size against file size.
(_bfd_elf_get_dynamic_reloc_upper_bound): Likewise.
bfd/ChangeLog
bfd/elf.c