summaryrefslogtreecommitdiff
path: root/bfd
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:32:45 -0800
commit4fb6d98c92870d7f693667267bbb3ef427e1c976 (patch)
tree5b1cdc5bdb58b6823136d800a5459ae0b6df5a38 /bfd
parentd236d41ee7a66700420697710f783d6832dc6aeb (diff)
downloadbinutils-4fb6d98c92870d7f693667267bbb3ef427e1c976.tar.gz
binutils-4fb6d98c92870d7f693667267bbb3ef427e1c976.tar.bz2
binutils-4fb6d98c92870d7f693667267bbb3ef427e1c976.zip
Check corrupt input
PR ld/17713 * elflink.c (_bfd_elf_gc_mark_rsec): Check corrupt input.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0ebd6d7103b..a4af0beb214 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/17713
+ * elflink.c (_bfd_elf_gc_mark_rsec): Check corrupt input.
+
2014-12-13 H.J. Lu <hongjiu.lu@intel.com>
PR ld/17689
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c964a98021c..94ab762a53a 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -11683,6 +11683,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;