public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] bfd_stat_arch_elt buffer overflow
Date: Tue, 10 Mar 2020 09:06:55 -0400	[thread overview]
Message-ID: <ff69a8949bb65c9eb64ea03ee1492902c2620c8c@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT ff69a8949bb65c9eb64ea03ee1492902c2620c8c ***

commit ff69a8949bb65c9eb64ea03ee1492902c2620c8c
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Thu Feb 27 13:50:21 2020 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Thu Feb 27 17:04:55 2020 +1030

    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.

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f0b7a4a238..ff03baa0dc 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 2d56fdad41..44bc7041cd 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))
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 463f94bb94..1c1238c036 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -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))


             reply	other threads:[~2020-03-10 13:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 13:06 gdb-buildbot [this message]
2020-03-10 13:06 ` Failures on Fedora-i686, branch master gdb-buildbot
2020-03-10 13:32 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-03-10 13:50 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-03-10 14:03 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-03-10 14:43 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-10 14:50 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-03-11 12:38 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, " gdb-buildbot
2020-03-11 14:27 ` Failures on Ubuntu-Aarch64-native-gdbserver-m64, " gdb-buildbot
2020-03-12  1:13 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot
2020-03-13  5:46 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff69a8949bb65c9eb64ea03ee1492902c2620c8c@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).