diff options
author | Ben Elliston <bje@au.ibm.com> | 2006-03-30 00:22:20 +0000 |
---|---|---|
committer | Ben Elliston <bje@au.ibm.com> | 2006-03-30 00:22:20 +0000 |
commit | b761a20733d1ddd57f42fefcc2e3aa272440dce7 (patch) | |
tree | 0c4e1b3c240f1373945255a897e271017b5ea224 /bfd/elflink.c | |
parent | 2bcb00c46021980ba271034168e28f4e4d027f36 (diff) | |
download | gdb-b761a20733d1ddd57f42fefcc2e3aa272440dce7.zip gdb-b761a20733d1ddd57f42fefcc2e3aa272440dce7.tar.gz gdb-b761a20733d1ddd57f42fefcc2e3aa272440dce7.tar.bz2 |
PR ld/2267
* elflink.c (elf_fixup_link_order): Ensure `elfsec' is not a
special section number that exceeds the number of ELF sections
(eg. SHN_MIPS_SCOMMON).
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index f0a0e83..88e56da 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7665,7 +7665,7 @@ elf_fixup_link_order (bfd *abfd, asection *o) struct bfd_link_order *p; bfd *sub; const struct elf_backend_data *bed = get_elf_backend_data (abfd); - int elfsec; + unsigned elfsec; struct bfd_link_order **sections; asection *s, *other_sec, *linkorder_sec; bfd_vma offset; @@ -7682,7 +7682,8 @@ elf_fixup_link_order (bfd *abfd, asection *o) sub = s->owner; if (bfd_get_flavour (sub) == bfd_target_elf_flavour && elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass - && (elfsec = _bfd_elf_section_from_bfd_section (sub, s)) != -1 + && (elfsec = _bfd_elf_section_from_bfd_section (sub, s)) + && elfsec < elf_numsections (sub) && elf_elfsections (sub)[elfsec]->sh_flags & SHF_LINK_ORDER) { seen_linkorder++; |