aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-m68hc1x.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-m68hc1x.c')
-rw-r--r--bfd/elf32-m68hc1x.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c
index 9ad82b6..2660c89 100644
--- a/bfd/elf32-m68hc1x.c
+++ b/bfd/elf32-m68hc1x.c
@@ -450,8 +450,13 @@ elf32_m68hc11_size_stubs (bfd *output_bfd, bfd *stub_bfd,
if (!is_far)
continue;
- hdr = elf_elfsections (input_bfd)[sym->st_shndx];
- sym_sec = hdr->bfd_section;
+ if (sym->st_shndx >= elf_numsections (input_bfd))
+ sym_sec = NULL;
+ else
+ {
+ hdr = elf_elfsections (input_bfd)[sym->st_shndx];
+ sym_sec = hdr->bfd_section;
+ }
stub_name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link,
sym->st_name));