public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Mach-O]: Reject 64 bit targets when not configured for
@ 2014-04-04 12:43 Tristan Gingold
  0 siblings, 0 replies; only message in thread
From: Tristan Gingold @ 2014-04-04 12:43 UTC (permalink / raw)
  To: binutils@sourceware.org Development

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

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

only message in thread, other threads:[~2014-04-04 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 12:43 [Mach-O]: Reject 64 bit targets when not configured for Tristan Gingold

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