PR22047, Heap out of bounds read in parse_comp_unit
authorAlan Modra <amodra@gmail.com>
Sun, 1 Oct 2017 01:37:59 +0000 (12:07 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 1 Oct 2017 01:37:59 +0000 (12:07 +1030)
commit4b04bba2eb6b646e11a2c38c77667875b3db6828
tree4e03802d9cbeb7652e5f33da3969fc79d74f5ba3
parent4f1881b94473f1034f950feb863b464435a8fb5f
PR22047, Heap out of bounds read in parse_comp_unit

Like the PR22230 fix, we can allocate a buffer with an extra byte
rather than letting bfd_simple_get_relocated_section_contents malloc
and return a buffer.  Much better than allocating another buffer
afterwards.

PR 22047
* dwarf2.c (read_section): Allocate buffer with extra byte for
bfd_simple_get_relocated_section_contents rather than copying
afterwards.
bfd/ChangeLog
bfd/dwarf2.c