diff options
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elf64-sparc.c | 18 |
2 files changed, 19 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 9a3b9b1..22837e0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2018-09-04 Jose E. Marchesi <jose.marchesi@oracle.com> + + * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Issue an + error when an invalid symbol index is retrieved in ELF64_R_SYM of + a relocation seen in an input file. + 2018-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com> Alan Modra <amodra@gmail.com> diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 8c45d32..41e1b7a 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -97,12 +97,20 @@ elf64_sparc_slurp_one_reloc_table (bfd *abfd, asection *asect, else relent->address = rela.r_offset - asect->vma; - if (ELF64_R_SYM (rela.r_info) == STN_UNDEF - /* PR 17512: file: 996185f8. */ - || (!dynamic && ELF64_R_SYM(rela.r_info) > bfd_get_symcount(abfd)) - || (dynamic - && ELF64_R_SYM(rela.r_info) > bfd_get_dynamic_symcount(abfd))) + if (ELF64_R_SYM (rela.r_info) == STN_UNDEF) relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + else if (/* PR 17512: file: 996185f8. */ + (!dynamic && ELF64_R_SYM(rela.r_info) > bfd_get_symcount(abfd)) + || (dynamic + && ELF64_R_SYM(rela.r_info) > bfd_get_dynamic_symcount(abfd))) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA): relocation %d has invalid symbol index %ld"), + abfd, asect, i, (long) ELF64_R_SYM (rela.r_info)); + bfd_set_error (bfd_error_bad_value); + relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; + } else { asymbol **ps, *s; |