From 00a17db39bf2131d085f8daf960e00ebda289330 Mon Sep 17 00:00:00 2001 From: nickc Date: Tue, 17 May 2005 16:23:20 +0000 Subject: [PATCH] (bfd_section_from_shdr): Add sanity check when parsing dynamic sections. --- bfd/ChangeLog | 5 +++++ bfd/elf.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3d2b2d9b23..feb815ffe9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2005-05-17 Tavis Ormandy + + * elf.c (bfd_section_from_shdr): Add sanity check when parsing + dynamic sections. + 2005-05-17 Alan Modra * elf32-ppc.c (LIS_11. LIS_12): Define. diff --git a/bfd/elf.c b/bfd/elf.c index 8e087e32dc..f77d626a30 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1768,6 +1768,9 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_DYNAMIC: /* Dynamic linking information. */ if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) return FALSE; + if (hdr->sh_link > elf_numsections (abfd) + || elf_elfsections (abfd)[hdr->sh_link] == NULL) + return FALSE; if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) { Elf_Internal_Shdr *dynsymhdr; -- 2.11.0