aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2014-12-15 08:27:57 -0800
committerH.J. Lu <hjl.tools@gmail.com>2014-12-15 08:27:57 -0800
commit263ddf68020ee659a221af45319984b4e73e8efe (patch)
tree81d9218464960607f0e17f460a2e7ee8fc23567f /bfd/elflink.c
parent4992aa2019c1b0467e60c6064b8aa958913f37e5 (diff)
downloadgdb-263ddf68020ee659a221af45319984b4e73e8efe.zip
gdb-263ddf68020ee659a221af45319984b4e73e8efe.tar.gz
gdb-263ddf68020ee659a221af45319984b4e73e8efe.tar.bz2
Check corrupt input
PR ld/17713 * elflink.c (_bfd_elf_gc_mark_rsec): Check corrupt input.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 2da6d1b..b701fa0 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;