PR24689, string table corruption
[deliverable/binutils-gdb.git] / bfd / elfcode.h
index a0487b0843cdbdbe640de536e6caefc7a2e5cbae..5180f79a74dfea8aab803e6c9d70429c146bedab 100644 (file)
@@ -754,7 +754,8 @@ elf_object_p (bfd *abfd)
   /* A further sanity check.  */
   if (i_ehdrp->e_shnum != 0)
     {
-      if (i_ehdrp->e_shstrndx >= elf_numsections (abfd))
+      if (i_ehdrp->e_shstrndx >= elf_numsections (abfd)
+         || i_shdrp[i_ehdrp->e_shstrndx].sh_type != SHT_STRTAB)
        {
          /* PR 2257:
             We used to just goto got_wrong_format_error here
This page took 0.030479 seconds and 4 git commands to generate.