diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-12-10 13:08:03 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-12-10 13:08:03 +0000 |
commit | b3559b217187c1aafeb3124f7643f7da077377d2 (patch) | |
tree | 7dd457d62afd9b695f3521dd6ce35ce5fefbba4e /bfd/elf.c | |
parent | 54a07680b01872ff74d874bcd27806e867e9e562 (diff) | |
download | gdb-b3559b217187c1aafeb3124f7643f7da077377d2.tar.gz |
* elf.c (bfd_elf_local_sym_name): Avoid crashes with invalid
st_shndx on STT_SECTION sections.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/bfd/elf.c b/bfd/elf.c index c14b91a53c1..2eef4baeecf 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -409,7 +409,10 @@ bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym) { unsigned int iname = isym->st_name; unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link; - if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION) + if (iname == 0 && ELF_ST_TYPE (isym->st_info) == STT_SECTION + /* Check for a bogus st_shndx to avoid crashing. */ + && isym->st_shndx < elf_numsections (abfd) + && !(isym->st_shndx >= SHN_LORESERVE && isym->st_shndx <= SHN_HIRESERVE)) { iname = elf_elfsections (abfd)[isym->st_shndx]->sh_name; shindex = elf_elfheader (abfd)->e_shstrndx; |