aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-06-02 16:32:45 +0100
committerNick Clifton <nickc@redhat.com>2016-06-02 16:32:45 +0100
commitc09ec62dde0fa128994402ddb09c3d0dfcd35e40 (patch)
tree137bfdbd207d42491ed6436a3053d1d99b8f8a45 /binutils/objcopy.c
parentbcc3a8bca12aa077e6d40880f2d41f05864d4798 (diff)
downloadgdb-c09ec62dde0fa128994402ddb09c3d0dfcd35e40.zip
gdb-c09ec62dde0fa128994402ddb09c3d0dfcd35e40.tar.gz
gdb-c09ec62dde0fa128994402ddb09c3d0dfcd35e40.tar.bz2
Also check that the group header's sh_info field is valid.
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.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 98332cd..06fcea3 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -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;