summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2000-12-15 18:53:04 +0000
committerNick Clifton <nickc@redhat.com>2000-12-15 18:53:04 +0000
commit294a8dd9dc007dff88bdd20791c3b1611045d122 (patch)
tree229ea06fa1d6908f68ad057cccc40d69e939d02a /bfd
parent6c698d4dacfb9d95597ce1e322630a95a5f38453 (diff)
downloadgdb-294a8dd9dc007dff88bdd20791c3b1611045d122.tar.gz
Move to the start of the program headers before attempting to read them.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfcore.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7eed9d29a51..99011eaf900 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/elfcore.h b/bfd/elfcore.h
index 11bfeac734f..f04c1d2a3b4 100644
--- a/bfd/elfcore.h
+++ b/bfd/elfcore.h
@@ -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);