Blob Blame History Raw
--- binutils.orig/bfd/elfcode.h	2020-05-13 11:18:04.792779506 +0100
+++ binutils-2.32/bfd/elfcode.h	2020-05-13 11:19:36.270101134 +0100
@@ -750,12 +750,9 @@ elf_object_p (bfd *abfd)
 		  != 0))
 	    abfd->flags &= ~D_PAGED;
 	}
-    }
 
-  /* 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