summaryrefslogtreecommitdiffstats
path: root/contrib/binutils
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2010-11-07 20:44:46 +0000
committergonzo <gonzo@FreeBSD.org>2010-11-07 20:44:46 +0000
commit2edfde994904860eb628d23f4ffd0ee0ede92110 (patch)
treeafa3d0e86a87446d55b8d5ca2fee4261a18cc4dc /contrib/binutils
parentce9c2777c86603e7f95cb82f708bffd0495eb5bf (diff)
downloadFreeBSD-src-2edfde994904860eb628d23f4ffd0ee0ede92110.zip
FreeBSD-src-2edfde994904860eb628d23f4ffd0ee0ede92110.tar.gz
Prevent endless loop by detecting broken MIPS.options
Diffstat (limited to 'contrib/binutils')
-rw-r--r--contrib/binutils/bfd/elfxx-mips.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/binutils/bfd/elfxx-mips.c b/contrib/binutils/bfd/elfxx-mips.c
index 0a7495a..87973d5 100644
--- a/contrib/binutils/bfd/elfxx-mips.c
+++ b/contrib/binutils/bfd/elfxx-mips.c
@@ -4330,6 +4330,15 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
&intopt);
+ if (intopt.size < sizeof (Elf_External_Options))
+ {
+ (*_bfd_error_handler)
+ (_("Warning: bad `%s' option size %u smaller than its header"),
+ MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+ break;
+ }
+
+
if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
{
bfd_byte buf[8];
@@ -4542,6 +4551,14 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
&intopt);
+ if (intopt.size < sizeof (Elf_External_Options))
+ {
+ (*_bfd_error_handler)
+ (_("Warning: bad `%s' option size %u smaller than its header"),
+ MIPS_ELF_OPTIONS_SECTION_NAME (abfd), intopt.size);
+ break;
+ }
+
if (ABI_64_P (abfd) && intopt.kind == ODK_REGINFO)
{
Elf64_Internal_RegInfo intreg;
OpenPOWER on IntegriCloud