aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-06-18 14:09:06 +0000
committerJakub Jelinek <jakub@redhat.com>2002-06-18 14:09:06 +0000
commit7ece0d85fda7871a1fc520016c38694441f14558 (patch)
tree86a48bac637542e69473625c8a8c64cf6fc2f08b /binutils
parentcc22880b3edfaa8be9302e9e634e3b91770242c6 (diff)
downloadgdb-7ece0d85fda7871a1fc520016c38694441f14558.zip
gdb-7ece0d85fda7871a1fc520016c38694441f14558.tar.gz
gdb-7ece0d85fda7871a1fc520016c38694441f14558.tar.bz2
binutils/
* readelf.c (get_file_header): Only read the first section header if e_shoff is non-zero. bfd/ * elfcode.h (elf_object_p): Sanity check eh_shoff == 0 implies e_shnum == 0. Only read the first section header if e_shoff is non-zero. Don't consider e_shstrndx if there are no sections.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c15
2 files changed, 14 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 26c052f..2463d81 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2002-06-18 Jakub Jelinek <jakub@redhat.com>
+
+ * readelf.c (get_file_header): Only read the first section header if
+ e_shoff is non-zero.
+
2002-06-15 H.J. Lu (hjl@gnu.org)
* nm.c (print_size): New variable. Initialize to 0.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0953109..4649b9b 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -9711,12 +9711,15 @@ get_file_header (file)
elf_header.e_shstrndx = BYTE_GET (ehdr64.e_shstrndx);
}
- /* There may be some extensions in the first section header. Don't
- bomb if we can't read it. */
- if (is_32bit_elf)
- get_32bit_section_headers (file, 1);
- else
- get_64bit_section_headers (file, 1);
+ if (elf_header.e_shoff)
+ {
+ /* There may be some extensions in the first section header. Don't
+ bomb if we can't read it. */
+ if (is_32bit_elf)
+ get_32bit_section_headers (file, 1);
+ else
+ get_64bit_section_headers (file, 1);
+ }
return 1;
}