public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: "binutils@sourceware.org Development" <binutils@sourceware.org>
Subject: [Mach-O]: Reject 64 bit targets when not configured for
Date: Fri, 04 Apr 2014 12:43:00 -0000	[thread overview]
Message-ID: <6143B2E1-D48D-4F65-A5CB-D9CAA945B7F8@adacore.com> (raw)

Hello,

the generic mach-o backend now rejects 64 bit mach-o files if bfd
is not configured for 64 bit targets. That avoids crashes (the first
one I encounter was in the disassembler).

Committed on trunk.

Tristan.

bfd/
	* mach-o.c (bfd_mach_o_header_p): Reject 64 bit target when not
	configured for.


diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 5203c0f..50173b9 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -4300,6 +4300,15 @@ bfd_mach_o_header_p (bfd *abfd,
       if (header.cputype != cputype)
         goto wrong;
     }
+  else
+    {
+#ifndef BFD64
+      /* Do not recognize 64 architectures if not configured for 64bit targets.
+	 This could happen only for generic targets.  */
+      if (mach_o_wide_p (&header))
+	 goto wrong;
+#endif
+    }
 
   if (filetype)
     {

                 reply	other threads:[~2014-04-04 12:43 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=6143B2E1-D48D-4F65-A5CB-D9CAA945B7F8@adacore.com \
    --to=gingold@adacore.com \
    --cc=binutils@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).