aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-04-16 12:59:37 +0100
committerNick Clifton <nickc@redhat.com>2018-04-16 12:59:37 +0100
commite9af4700bc7435e593dd74d4d2e099b3d7c01eb6 (patch)
tree6be43cbbf7061b3e67e81a6c0c386fe25dc70332 /bfd
parentddb000396c9246649e02669e0bd6ad3949973e5a (diff)
downloadgdb-e9af4700bc7435e593dd74d4d2e099b3d7c01eb6.zip
gdb-e9af4700bc7435e593dd74d4d2e099b3d7c01eb6.tar.gz
gdb-e9af4700bc7435e593dd74d4d2e099b3d7c01eb6.tar.bz2
Prevent an illegal memory access via an out of range fixup pointer.
PR 23061 * coffgen.c (coff_pointerize_aux): Check for an out of range fixup.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/coffgen.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9f81866..3ea3933 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-04-16 Nick Clifton <nickc@redhat.com>
+
+ PR 23061
+ * coffgen.c (coff_pointerize_aux): Check for an out of range
+ fixup.
+
2018-04-16 Alan Modra <amodra@gmail.com>
* Makefile.am: Remove arm-epoc-pe support.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index ff445d2..b9e4872 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -835,7 +835,7 @@ coff_mangle_symbols (bfd *bfd_ptr)
for (i = 0; i < s->u.syment.n_numaux; i++)
{
combined_entry_type *a = s + i + 1;
-
+
BFD_ASSERT (! a->is_sym);
if (a->fix_tag)
{
@@ -1547,7 +1547,9 @@ coff_pointerize_aux (bfd *abfd,
if ((ISFCN (type) || ISTAG (n_sclass) || n_sclass == C_BLOCK
|| n_sclass == C_FCN)
- && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0)
+ && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l > 0
+ && auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l
+ < (long) obj_raw_syment_count (abfd))
{
auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p =
table_base + auxent->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l;