aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-09-18 13:25:35 +0000
committerDaniel Jacobowitz <drow@false.org>2002-09-18 13:25:35 +0000
commit05a487dc8c398898e46d2ba52cc3e05f3f25b965 (patch)
tree5cee66b0a1d40fae894ada0bb53e797e569c697e /bfd
parentcb7e422f1e2dbcd8da9eb807440e4b9e6a0e0f94 (diff)
downloadgdb-05a487dc8c398898e46d2ba52cc3e05f3f25b965.zip
gdb-05a487dc8c398898e46d2ba52cc3e05f3f25b965.tar.gz
gdb-05a487dc8c398898e46d2ba52cc3e05f3f25b965.tar.bz2
* elfcode.h (elf_slurp_reloc_table_from_section): Check
correct relocation count.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfcode.h8
2 files changed, 12 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f0c5ef5..9a0f1eb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-18 Daniel Jacobowitz <drow@mvista.com>
+
+ * elfcode.h (elf_slurp_reloc_table_from_section): Check
+ correct relocation count.
+
2002-09-17 Daniel Jacobowitz <drow@mvista.com>
* bfd-in.h (bfd_get_dynamic_symcount): Define.
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 7f9ed5f..ca72307 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"),