aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2001-04-26 19:09:20 +0000
committerH.J. Lu <hjl.tools@gmail.com>2001-04-26 19:09:20 +0000
commitf5f31454c5ac651ce6f2b30ee7d7531ae172c35b (patch)
treeeb0902f46388efd6cb0e4b6ad2741c718ec52961 /bfd/elf32-i386.c
parent16a0c2d4eced24ba71a9df4e764819941af5df83 (diff)
downloadgdb-f5f31454c5ac651ce6f2b30ee7d7531ae172c35b.zip
gdb-f5f31454c5ac651ce6f2b30ee7d7531ae172c35b.tar.gz
gdb-f5f31454c5ac651ce6f2b30ee7d7531ae172c35b.tar.bz2
2001-04-26 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is valid.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 658c86d..f4e1e50 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -501,6 +501,20 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
r_symndx = ELF32_R_SYM (rel->r_info);
+ if (r_symndx >= symtab_hdr->sh_size / symtab_hdr->sh_entsize)
+ {
+ if (abfd->my_archive)
+ (*_bfd_error_handler) (_("%s(%s): bad symbol index: %d"),
+ bfd_get_filename (abfd->my_archive),
+ bfd_get_filename (abfd),
+ r_symndx);
+ else
+ (*_bfd_error_handler) (_("%s: bad symbol index: %d"),
+ bfd_get_filename (abfd),
+ r_symndx);
+ return false;
+ }
+
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
@@ -686,7 +700,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
(*_bfd_error_handler) (_("%s: bad relocation section name `%s\'"),
bfd_get_filename (abfd),
name);
- }
+ }
sreloc = bfd_get_section_by_name (dynobj, name);
if (sreloc == NULL)