aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2005-05-18 13:41:59 +0000
committerH.J. Lu <hjl.tools@gmail.com>2005-05-18 13:41:59 +0000
commit13792e9d85c5cdd3a37f675ce4006ad546ad91f1 (patch)
treedcda0e043c34280947c6e9021e1633f5d61cd924
parenta0ef61f7a061fa836f9b09178c4347bdc159a4f6 (diff)
downloadgdb-13792e9d85c5cdd3a37f675ce4006ad546ad91f1.zip
gdb-13792e9d85c5cdd3a37f675ce4006ad546ad91f1.tar.gz
gdb-13792e9d85c5cdd3a37f675ce4006ad546ad91f1.tar.bz2
2005-05-18 H.J. Lu <hongjiu.lu@intel.com>
* elf.c (group_signature): Check if the symbol table section is correct.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf.c22
2 files changed, 10 insertions, 17 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 76f3f26..9452a35 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf.c (group_signature): Undo the last change. Check if the
+ symbol table section is correct.
+
2005-05-17 Zack Weinberg <zack@codesourcery.com>
* elf32-arm.c: Wherever possible, use official reloc names
diff --git a/bfd/elf.c b/bfd/elf.c
index 3ef04d4..2f610ba 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -451,24 +451,12 @@ group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr)
unsigned char esym[sizeof (Elf64_External_Sym)];
Elf_External_Sym_Shndx eshndx;
Elf_Internal_Sym isym;
- unsigned int i;
-
- if (ghdr == NULL)
- return NULL;
-
- /* If this section is linked to by other sections then it is a symbol or
- string section which is masquerading as a group. This is a bad thing,
- and if we carry on to the call to bfd_section_from_shdr below we will
- enter an infinite loop. So check now and break out if we detect this
- case. See:
- http://sources.redhat.com/ml/binutils/2005-05/msg00421.html
- for a report of a case that tirggers this code. */
- for (i = elf_numsections (abfd); i--;)
- if (elf_elfsections (abfd) [elf_elfsections (abfd) [i]->sh_link] == ghdr)
- return NULL;
- /* Next we need to ensure the symbol table is available. */
- if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
+ /* First we need to ensure the symbol table is available. Make sure
+ that it is a symbol table section. */
+ hdr = elf_elfsections (abfd) [ghdr->sh_link];
+ if (hdr->sh_type != SHT_SYMTAB
+ || ! bfd_section_from_shdr (abfd, ghdr->sh_link))
return NULL;
/* Go read the symbol. */