aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-05-17 16:23:26 +0000
committerNick Clifton <nickc@redhat.com>2005-05-17 16:23:26 +0000
commit8e0ed13fa56c0f18e69a559dcace1fc9431874a2 (patch)
tree75e147594e2ac940016e8b29fb3d9fce40a44653 /bfd/elf.c
parent39ddb54e58f750cfbdff29c1795483a0c505c8ad (diff)
downloadgdb-8e0ed13fa56c0f18e69a559dcace1fc9431874a2.zip
gdb-8e0ed13fa56c0f18e69a559dcace1fc9431874a2.tar.gz
gdb-8e0ed13fa56c0f18e69a559dcace1fc9431874a2.tar.bz2
(bfd_section_from_shdr): Add sanity check when parsing dynamic sections.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index 8e087e3..f77d626 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;