Detect and report corrupt relocs
authorNick Clifton <nickc@redhat.com>
Fri, 21 Jul 2000 19:56:19 +0000 (19:56 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 21 Jul 2000 19:56:19 +0000 (19:56 +0000)
bfd/ChangeLog
bfd/elf32-mips.c

index 09725de15c5ba473c4c834f0c44367c68d579ff2..eee5f1ac75d0abf6d468977afa292cccc486685a 100644 (file)
@@ -1,3 +1,8 @@
+2000-07-21  Nick Clifton  <nickc@cygnus.com>
+
+       * elf32-mips.c (_bfd_mips_elf_check_relocs): Detect out of
+       range symbol indices in relocs and issue an error message.
+
 2000-07-20  H.J. Lu  <hjl@gnu.org>
 
        * elflink.h (NAME(bfd_elf,size_dynamic_sections)): Don't check
index 27ae18abb9823ec9e0c8acf472008a9fcec9f889..f6a60baa56e99e7753ed401cef8886cfeaba18e3 100644 (file)
@@ -7593,6 +7593,13 @@ _bfd_mips_elf_check_relocs (abfd, info, sec, relocs)
 
       if (r_symndx < extsymoff)
        h = NULL;
+      else if (r_symndx >= extsymoff + (symtab_hdr->sh_size / symtab_hdr->sh_entsize))
+       {
+         (*_bfd_error_handler)
+           (_("Malformed reloc detected for section %s"), name);
+         bfd_set_error (bfd_error_bad_value);
+         return false;
+       }
       else
        {
          h = sym_hashes[r_symndx - extsymoff];