aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-05-07 22:41:47 +0930
committerAlan Modra <amodra@gmail.com>2018-05-07 22:50:31 +0930
commitce4ec1a9b6c442a9feefa18dd8734372a718665c (patch)
treecebd17c4a753f5d271f2aa4fbb0a8637cb15feb5 /binutils
parent7bd8862c3ad0ee291d27837ae3cd30288a00b922 (diff)
downloadfsf-binutils-gdb-ce4ec1a9b6c442a9feefa18dd8734372a718665c.zip
fsf-binutils-gdb-ce4ec1a9b6c442a9feefa18dd8734372a718665c.tar.gz
fsf-binutils-gdb-ce4ec1a9b6c442a9feefa18dd8734372a718665c.tar.bz2
Bug 23142, SIGSEGV in is_strip_section
PR 23142 * objcopy.c (group_signature): Don't accept groups that use a symbol table other than the one we've read.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/objcopy.c9
2 files changed, 10 insertions, 5 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 61bbd2f..29fd1c2 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2018-05-07 Alan Modra <amodra@gmail.com>
+
+ PR 23142
+ * objcopy.c (group_signature): Don't accept groups that use a
+ symbol table other than the one we've read.
+
2018-04-30 Francois H. Theron <francois.theron@netronome.com>
* readelf.c: Very basic support for EM_NFP and its section types.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 61c513b..fadc957 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1211,14 +1211,13 @@ group_signature (asection *group)
return NULL;
ghdr = &elf_section_data (group)->this_hdr;
- if (ghdr->sh_link < elf_numsections (abfd))
+ if (ghdr->sh_link == elf_onesymtab (abfd))
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- Elf_Internal_Shdr *symhdr = elf_elfsections (abfd) [ghdr->sh_link];
+ Elf_Internal_Shdr *symhdr = &elf_symtab_hdr (abfd);
- if (symhdr->sh_type == SHT_SYMTAB
- && ghdr->sh_info > 0
- && ghdr->sh_info < (symhdr->sh_size / bed->s->sizeof_sym))
+ if (ghdr->sh_info > 0
+ && ghdr->sh_info < symhdr->sh_size / bed->s->sizeof_sym)
return isympp[ghdr->sh_info - 1];
}
return NULL;