From: Alan Modra <amodra@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] Segfault in _bfd_delete_bfd with USE_MMAP
Date: Thu, 11 Apr 2024 00:09:34 +0000 (GMT) [thread overview]
Message-ID: <20240411000934.DEE3838708AC@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ea3002bc4d2a3c8ad284041f8a7dd08472c3f5fa
commit ea3002bc4d2a3c8ad284041f8a7dd08472c3f5fa
Author: Alan Modra <amodra@gmail.com>
Date: Thu Apr 11 09:25:13 2024 +0930
Segfault in _bfd_delete_bfd with USE_MMAP
Any of the calls to _bfd_delete_bfd in bfd_fopen will hit this.
* opncls.c (_bfd_delete_bfd): Check for non-NULL xvec before
accessing flavour.
Diff:
---
bfd/opncls.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 2f8a3a6c919..bc76696dfdb 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -164,7 +164,8 @@ static void
_bfd_delete_bfd (bfd *abfd)
{
#ifdef USE_MMAP
- if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
+ if (abfd->xvec
+ && abfd->xvec->flavour == bfd_target_elf_flavour)
{
asection *sec;
for (sec = abfd->sections; sec != NULL; sec = sec->next)
reply other threads:[~2024-04-11 0:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240411000934.DEE3838708AC@sourceware.org \
--to=amodra@sourceware.org \
--cc=binutils-cvs@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).