bfd_stat_arch_elt buffer overflow
authorAlan Modra <amodra@gmail.com>
Thu, 27 Feb 2020 03:20:21 +0000 (13:50 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 27 Feb 2020 06:34:55 +0000 (17:04 +1030)
commitff69a8949bb65c9eb64ea03ee1492902c2620c8c
tree80050e74973dfc6421249bad117b7691ccd55f77
parentd0adf5451e2200aac8ba903fd77a33879c5a5d9b
bfd_stat_arch_elt buffer overflow

If you manage to put an xcoff object file into a non-xcoff archive
(created by first putting a non-xcoff object file into it), and have
xcoff support compiled into libbfd, then objdump -x on the archive
can segfault.  The problem is that _bfd_xcoff_stat_arch_elt expects
abfd->arelt_data->arch_header to be one of the xcoff variants, but
arelt_data is generated depending on the archive format, *not* the
element format.

* bfd.c (bfd_stat_arch_elt): Use vector of containing archive,
if file is an archive element.
* bfd-in2.h: Regenerate.
bfd/ChangeLog
bfd/bfd-in2.h
bfd/bfd.c