]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - bfd/coffcode.h
PR28402, fail to allocate line number array
authorAlan Modra <amodra@gmail.com>
Wed, 6 Oct 2021 03:08:42 +0000 (13:38 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 6 Oct 2021 05:00:23 +0000 (15:30 +1030)
commit1808483c2f3f323d8e0398282251a85cd956321b
tree8bcb354ac28060267ad47a80ff98606ed9c65181
parent0a6041ce9383338fa62acb207683780faaa8b42c
PR28402, fail to allocate line number array

This fixes a situation where the COFF code allocated memory for
internal representaion arrays before reading the external file data.
That meant the allocation didn't have any sanity check against file
size.

PR 28402
* coffcode.h (buy_and_read): Malloc rather than alloc memory.
(coff_slurp_line_table): Read native line number info before
allocating memory for internal line number array.  Adjust error
paths to suit.  Remove now unnecessary line number count check.
(coff_slurp_reloc_table): Adjust to suit buy_and_read change.
bfd/coffcode.h