Move to the start of the program headers before attempting to read them.
authorNick Clifton <nickc@redhat.com>
Fri, 15 Dec 2000 18:53:04 +0000 (18:53 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 15 Dec 2000 18:53:04 +0000 (18:53 +0000)
bfd/ChangeLog
bfd/elfcore.h

index 7eed9d29a5194864e9e990fcd66cb8d34095fc38..99011eaf900a3d7da543b32245186b4b61d74728 100644 (file)
@@ -1,3 +1,8 @@
+2000-12-15  Miloslav Trmac <mitr@volny.cz>
+
+       * elfcore.h (elf_core_file_p): Move to the start of the program
+       headers before attempting to read them.
+
 2000-12-14  Kazu Hirata  <kazu@hxi.com>
 
        * peigen.c: Fix formatting.
index 11bfeac734fabe044868fc632812ee703cf92572..f04c1d2a3b4bd789a5ca14fcf0bd821932965f54 100644 (file)
@@ -182,6 +182,10 @@ elf_core_file_p (abfd)
   if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
     goto wrong;
 
+  /* Move to the start of the program headers.  */
+  if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) != 0)
+    goto wrong;
+  
   /* Allocate space for the program headers. */
   i_phdrp = (Elf_Internal_Phdr *)
     bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);