public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] Re: USE_MMAP fuzzed object file attacks
Date: Thu,  4 Apr 2024 02:51:45 +0000 (GMT)	[thread overview]
Message-ID: <20240404025145.AF9003858404@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0ab0435fe672b76f0efb8814594b65c8e968d983

commit 0ab0435fe672b76f0efb8814594b65c8e968d983
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Apr 4 12:50:17 2024 +1030

    Re: USE_MMAP fuzzed object file attacks
    
    I committed a broken patch.
    
            * aoutx.h (aout_get_external_symbols): Remove wrong #else and
            unneeded casts.
            * pdp11.c (aout_get_external_symbols): Likewise.

Diff:
---
 bfd/aoutx.h | 7 +++----
 bfd/pdp11.c | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index fb6326d79d1..d98ba61a339 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1322,21 +1322,20 @@ aout_get_external_symbols (bfd *abfd)
 	  if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
 				     &obj_aout_sym_window (abfd), true))
 	    return false;
-	  syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+	  syms = obj_aout_sym_window (abfd).data;
 	}
       else
-#else
+#endif
 	{
 	  /* We allocate using malloc to make the values easy to free
 	     later on.  If we put them on the objalloc it might not be
 	     possible to free them.  */
 	  if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
 	    return false;
-	  syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+	  syms = _bfd_malloc_and_read (abfd, amt, amt);
 	  if (syms == NULL)
 	    return false;
 	}
-#endif
 
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index f9ded64c933..b20c39659db 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1299,21 +1299,20 @@ aout_get_external_symbols (bfd *abfd)
 	  if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
 				     &obj_aout_sym_window (abfd), true))
 	    return false;
-	  syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+	  syms = obj_aout_sym_window (abfd).data;
 	}
       else
-#else
+#endif
 	{
 	  /* We allocate using malloc to make the values easy to free
 	     later on.  If we put them on the objalloc it might not be
 	     possible to free them.  */
 	  if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
 	    return false;
-	  syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+	  syms = _bfd_malloc_and_read (abfd, amt, amt);
 	  if (syms == NULL)
 	    return false;
 	}
-#endif
 
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;

                 reply	other threads:[~2024-04-04  2:51 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=20240404025145.AF9003858404@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).