diff options
author | Daniel Jacobowitz <dan@debian.org> | 2002-09-18 13:25:35 +0000 |
---|---|---|
committer | Daniel Jacobowitz <dan@debian.org> | 2002-09-18 13:25:35 +0000 |
commit | b6e58273ff007baace53a98eb333a95fadb6b4f4 (patch) | |
tree | de9814ab4a3cae54b1d8781a990c66ff74c3727a /bfd/elfcode.h | |
parent | 4ded51f37bb9fd7c3ded27b647124d3784d8936d (diff) | |
download | gdb-b6e58273ff007baace53a98eb333a95fadb6b4f4.tar.gz |
* elfcode.h (elf_slurp_reloc_table_from_section): Check
correct relocation count.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r-- | bfd/elfcode.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 7f9ed5fe3af..ca72307710a 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1377,6 +1377,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count, arelent *relent; unsigned int i; int entsize; + long symcount; allocated = (PTR) bfd_malloc (rel_hdr->sh_size); if (allocated == NULL) @@ -1419,9 +1420,14 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count, else relent->address = rela.r_offset - asect->vma; + if (dynamic) + symcount = bfd_get_dynamic_symcount (abfd); + else + symcount = bfd_get_symcount (abfd); + if (ELF_R_SYM (rela.r_info) == 0) relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; - else if (ELF_R_SYM (rela.r_info) > bfd_get_dynamic_symcount (abfd)) + else if (ELF_R_SYM (rela.r_info) > symcount) { (*_bfd_error_handler) (_("%s(%s): relocation %d has invalid symbol index %ld"), |