PR 7023
authorAlan Modra <amodra@gmail.com>
Wed, 12 Nov 2008 22:04:04 +0000 (22:04 +0000)
committerAlan Modra <amodra@gmail.com>
Wed, 12 Nov 2008 22:04:04 +0000 (22:04 +0000)
* elf.c (bfd_section_from_shdr <SHT_SYMTAB>): Fail on invalid sh_info.

bfd/ChangeLog
bfd/elf.c

index 0452dbb71bde87fba980038e214995cb485dc46f..3d5c0226b9cf5b0a3041002a2d13b68f9fe714f7 100644 (file)
@@ -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.
index 054fd2a410539e29e3c39017f7347f1848ab464d..cb7d2fc3e447b50da53ad3958cc6bd5d8a9968d0 100644 (file)
--- 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;