From: H.J. Lu Date: Thu, 26 Apr 2001 19:09:20 +0000 (+0000) Subject: 2001-04-26 H.J. Lu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f5f31454c5ac651ce6f2b30ee7d7531ae172c35b;p=binutils-gdb.git 2001-04-26 H.J. Lu * elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is valid. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 17ec1b67383..37ffb671e34 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2001-04-26 H.J. Lu + + * elf32-i386.c (elf_i386_check_relocs): Verify if r_symndx is + valid. + 2001-04-25 Frank Ch. Eigler * bfd-in.h (bfd_cache_close): Declare newly exported function. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 658c86deb1c..f4e1e500c32 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)