summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2008-11-12 22:04:03 +0000
committerAlan Modra <amodra@bigpond.net.au>2008-11-12 22:04:03 +0000
commit09e7ed66cf8f63905a65618c82e26bc5577998de (patch)
tree5cd6ffda3ea37fd6336abf35677db57c19b7d6e5
parentc219a7436c70547cae2b9fd04c6753f8b5413eb4 (diff)
downloadgdb-09e7ed66cf8f63905a65618c82e26bc5577998de.tar.gz
PR 7023
* elf.c (bfd_section_from_shdr <SHT_SYMTAB>): Fail on invalid sh_info.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0452dbb71bd..3d5c0226b9c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-13 Alan Modra <amodra@bigpond.net.au>
+
+ PR 7023
+ * elf.c (bfd_section_from_shdr <SHT_SYMTAB>): Fail on invalid sh_info.
+
2008-11-12 Tristan Gingold <gingold@adacore.com>
* bfd.c (bfd_get_sign_extend_vma): Return 0 for mach-o.
diff --git a/bfd/elf.c b/bfd/elf.c
index 054fd2a4105..cb7d2fc3e44 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1608,6 +1608,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
if (hdr->sh_entsize != bed->s->sizeof_sym)
return FALSE;
+ if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size)
+ return FALSE;
BFD_ASSERT (elf_onesymtab (abfd) == 0);
elf_onesymtab (abfd) = shindex;
elf_tdata (abfd)->symtab_hdr = *hdr;