summaryrefslogtreecommitdiffstats
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2009-01-27 16:37:10 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2009-01-27 16:37:10 +0000
commit27cc28f94b69c07ac6c4b1834c2e65538dbbcc3a (patch)
treeadc5ea2e72ea4f231e7ddf83f4953f6580822be0 /bfd/mach-o.c
parent1b0adfe09ccf94ad63361691d2e9e81b22896267 (diff)
downloadppe42-binutils-27cc28f94b69c07ac6c4b1834c2e65538dbbcc3a.tar.gz
ppe42-binutils-27cc28f94b69c07ac6c4b1834c2e65538dbbcc3a.zip
* mach-o.c (bfd_mach_o_archive_p): Restrict the number of
architectures in the archive.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 9ae1bba1f7..e0a6fa4772 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -2098,6 +2098,11 @@ bfd_mach_o_archive_p (bfd *abfd)
adata->nfat_arch = bfd_getb32 (buf + 4);
if (adata->magic != 0xcafebabe)
goto error;
+ /* Avoid matching Java bytecode files, which have the same magic number.
+ In the Java bytecode file format this field contains the JVM version,
+ which starts at 43.0. */
+ if (adata->nfat_arch > 30)
+ goto error;
adata->archentries =
bfd_alloc (abfd, adata->nfat_arch * sizeof (mach_o_fat_archentry));
OpenPOWER on IntegriCloud