diff options
author | Alan Modra <amodra@gmail.com> | 2020-02-27 13:50:21 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-02-27 17:04:55 +1030 |
commit | ff69a8949bb65c9eb64ea03ee1492902c2620c8c (patch) | |
tree | 80050e74973dfc6421249bad117b7691ccd55f77 | |
parent | d0adf5451e2200aac8ba903fd77a33879c5a5d9b (diff) | |
download | gdb-ff69a8949bb65c9eb64ea03ee1492902c2620c8c.zip gdb-ff69a8949bb65c9eb64ea03ee1492902c2620c8c.tar.gz gdb-ff69a8949bb65c9eb64ea03ee1492902c2620c8c.tar.bz2 |
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.
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 3 | ||||
-rw-r--r-- | bfd/bfd.c | 3 |
3 files changed, 10 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f0b7a4a..ff03baa 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2020-02-27 Alan Modra <amodra@gmail.com> + + * bfd.c (bfd_stat_arch_elt): Use vector of containing archive, + if file is an archive element. + * bfd-in2.h: Regenerate. + 2020-02-26 Alan Modra <amodra@gmail.com> * archive.c (do_slurp_bsd_armap): Increase minimum parsed_size, and diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 2d56fda..44bc704 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7121,7 +7121,8 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) #define bfd_stat_arch_elt(abfd, stat) \ - BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) + BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \ + _bfd_stat_arch_elt, (abfd, stat)) #define bfd_update_armap_timestamp(abfd) \ BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) @@ -2063,7 +2063,8 @@ DESCRIPTION . BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) . .#define bfd_stat_arch_elt(abfd, stat) \ -. BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) +. BFD_SEND (abfd->my_archive ? abfd->my_archive : abfd, \ +. _bfd_stat_arch_elt, (abfd, stat)) . .#define bfd_update_armap_timestamp(abfd) \ . BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) |