From 263ddf68020ee659a221af45319984b4e73e8efe Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 15 Dec 2014 08:27:57 -0800 Subject: [PATCH] Check corrupt input PR ld/17713 * elflink.c (_bfd_elf_gc_mark_rsec): Check corrupt input. --- bfd/ChangeLog | 5 +++++ bfd/elflink.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 23e4ba5d44b..561c6031973 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-12-15 H.J. Lu + + PR ld/17713 + * elflink.c (_bfd_elf_gc_mark_rsec): Check corrupt input. + 2014-12-13 H.J. Lu PR ld/17689 diff --git a/bfd/elflink.c b/bfd/elflink.c index 2da6d1b8ce7..b701fa0d536 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -11860,6 +11860,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec, || ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL) { h = cookie->sym_hashes[r_symndx - cookie->extsymoff]; + if (h == NULL) + { + info->callbacks->einfo (_("%F%P: corrupt input: %B\n"), + sec->owner); + return NULL; + } while (h->root.type == bfd_link_hash_indirect || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; -- 2.30.2