Also check that the group header's sh_info field is valid.
authorNick Clifton <nickc@redhat.com>
Thu, 2 Jun 2016 15:32:45 +0000 (16:32 +0100)
committerNick Clifton <nickc@redhat.com>
Thu, 2 Jun 2016 15:32:45 +0000 (16:32 +0100)
PR 20089
* objcopy.c (group_signature): Fail if the input symbol table has
not been loaded, or if the sh_info field of the group header is 0.

binutils/ChangeLog
binutils/objcopy.c

index a91b99b4e7e45470e2a1f8321b208865a68532f3..f8e7c769ebc801c887564eee1054bc7da31814e9 100644 (file)
@@ -2,7 +2,7 @@
 
        PR 20089
        * objcopy.c (group_signature): Fail if the input symbol table has
-       not been loaded.
+       not been loaded, or if the sh_info field of the group header is 0.
 
        * dwarf.c (display_debug_frames): Do not display any
        interpretation if the block consists solely of DW__CFA_NOPs.
index 98332cd3dc2c1f748e5e17081ccdab93769a02d9..06fcea3f8b6b17c282c57f658626a6d8961e57f2 100644 (file)
@@ -1139,7 +1139,8 @@ group_signature (asection *group)
       Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
 
       if (symhdr->sh_type == SHT_SYMTAB
-         && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
+         && ghdr->sh_info > 0
+         && ghdr->sh_info < (symhdr->sh_size / bed->s->sizeof_sym))
        return isympp[ghdr->sh_info - 1];
     }
   return NULL;