aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2016-07-15 17:02:00 +0930
committerAlan Modra <amodra@gmail.com>2016-07-15 17:02:00 +0930
commit06ab6faf83ce47ca64198819eee02e4e56dc5a74 (patch)
treeb892a47dbe32cc573577edf478a15e0561b499d1 /bfd/cofflink.c
parent50c1cbe1895eaa6cdc7163851799f6f5d8f9336f (diff)
downloadbinutils-06ab6faf83ce47ca64198819eee02e4e56dc5a74.zip
binutils-06ab6faf83ce47ca64198819eee02e4e56dc5a74.tar.gz
binutils-06ab6faf83ce47ca64198819eee02e4e56dc5a74.tar.bz2
COFF buffer overflow in mark_relocs
* cofflink.c (mark_relocs): Exclude relocs with -1 r_symndx from marking sym_indices.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index bcdf778..0f6ef59 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -1398,7 +1398,8 @@ mark_relocs (struct coff_final_link_info *flaginfo, bfd *input_bfd)
in the relocation table. This will then be picked up in the
skip/don't-skip pass. */
for (; irel < irelend; irel++)
- flaginfo->sym_indices[ irel->r_symndx ] = -1;
+ if ((unsigned long) irel->r_symndx < obj_raw_syment_count (input_bfd))
+ flaginfo->sym_indices[irel->r_symndx] = -1;
}
}