public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Segfault in _bfd_delete_bfd with USE_MMAP
@ 2024-04-11  0:09 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-04-11  0:09 UTC (permalink / raw)
  To: binutils-cvs

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-11  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11  0:09 [binutils-gdb] Segfault in _bfd_delete_bfd with USE_MMAP Alan Modra

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).