summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-05-24 13:53:30 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-05-24 13:53:30 +0000
commit391cb864cfe945be3f88dbfbd5cc252f13e96317 (patch)
tree1a0f236d2a7a2c660ed5432314276c35ef974abd
parentcc1285c7485693e36034903140f52378e8d1f78a (diff)
downloadbinutils-gdb-391cb864cfe945be3f88dbfbd5cc252f13e96317.tar.gz
2005-05-24 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (process_section_groups): Report group section index. Check if the section member index is valid.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/readelf.c21
2 files changed, 22 insertions, 4 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 1a6bc31cd1d..e72be0b7557 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * readelf.c (process_section_groups): Report group section
+ index. Check if the section member index is valid.
+
2005-05-23 Fred Fish <fnf@specifixinc.com>
* addr2line.c (unwind_inlines): New flag for 'i' option.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 5dafc510c97..ab0243edb1d 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -4187,8 +4187,8 @@ process_section_groups (FILE *file)
if (do_section_groups)
{
- printf ("\n%s group section `%s' [%s] contains %u sections:\n",
- get_group_flags (entry), name, group_name, size);
+ printf ("\n%s group section [%5u] `%s' [%s] contains %u sections:\n",
+ get_group_flags (entry), i, name, group_name, size);
printf (_(" [Index] Name\n"));
}
@@ -4202,13 +4202,26 @@ process_section_groups (FILE *file)
entry = byte_get (indices, 4);
indices += 4;
+ if (entry >= elf_header.e_shnum)
+ {
+ error (_("section [%5u] in group section [%5u] > maximum section [%5u]\n"),
+ entry, i, elf_header.e_shnum - 1);
+ continue;
+ }
+ else if (entry >= SHN_LORESERVE && entry <= SHN_HIRESERVE)
+ {
+ error (_("invalid section [%5u] in group section [%5u]\n"),
+ entry, i);
+ continue;
+ }
+
if (section_headers_groups [SECTION_HEADER_INDEX (entry)]
!= NULL)
{
if (entry)
{
- error (_("section [%5u] already in group section [%5u]\n"),
- entry,
+ error (_("section [%5u] in group section [%5u] already in group section [%5u]\n"),
+ entry, i,
section_headers_groups [SECTION_HEADER_INDEX (entry)]->group_index);
continue;
}