From: Andreas Schwab Date: Tue, 27 Jan 2009 16:37:10 +0000 (+0000) Subject: * mach-o.c (bfd_mach_o_archive_p): Restrict the number of X-Git-Tag: sid-snapshot-20090201~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27cc28f94b69c07ac6c4b1834c2e65538dbbcc3a;p=external%2Fbinutils.git * mach-o.c (bfd_mach_o_archive_p): Restrict the number of architectures in the archive. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 41cee38..f6102d5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2009-01-27 Andreas Schwab + + * mach-o.c (bfd_mach_o_archive_p): Restrict the number of + architectures in the archive. + 2009-01-27 Hans-Peter Nilsson * elf32-cris.c (cris_elf_relocate_section) diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 9ae1bba..e0a6fa4 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));