diff options
author | Ian Lance Taylor <ian@airs.com> | 1999-06-22 21:25:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1999-06-22 21:25:49 +0000 |
commit | 03ae5f594ecda3eccaa441dd8454889379980c1d (patch) | |
tree | c694b7ffe73b9bf46fa0e09afa36654b0bfbc497 /bfd/elf.c | |
parent | 7b9eea348fbba7b2fb103bf63e9e34973c1cddff (diff) | |
download | gdb-03ae5f594ecda3eccaa441dd8454889379980c1d.zip gdb-03ae5f594ecda3eccaa441dd8454889379980c1d.tar.gz gdb-03ae5f594ecda3eccaa441dd8454889379980c1d.tar.bz2 |
* elf.c (bfd_section_from_shdr): Avoid crashing on a bogus sh_link
field.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1201,6 +1201,15 @@ bfd_section_from_shdr (abfd, shindex) asection *target_sect; Elf_Internal_Shdr *hdr2; + /* Check for a bogus link to avoid crashing. */ + if (hdr->sh_link >= ehdr->e_shnum) + { + ((*_bfd_error_handler) + (_("%s: invalid link %lu for reloc section %s (index %u)"), + bfd_get_filename (abfd), hdr->sh_link, name, shindex)); + return _bfd_elf_make_section_from_shdr (abfd, hdr, name); + } + /* For some incomprehensible reason Oracle distributes libraries for Solaris in which some of the objects have bogus sh_link fields. It would be nice if we could just |