summaryrefslogtreecommitdiff
path: root/bfd/pdp11.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-10-06 10:17:29 +1030
committerAlan Modra <amodra@gmail.com>2021-10-06 11:24:29 +1030
commit0a6041ce9383338fa62acb207683780faaa8b42c (patch)
tree1996d2e58fac46ae1ed3ea5366571d7c9223f88e /bfd/pdp11.c
parent55e3926e79937da55da3eaad3b15b4c099071976 (diff)
PR28403, null pointer dereference in disassemble_bytes
Indexing of symbol and howto arrays wasn't checked in aout targets. PR 28403 * aout-ns32k.c (MY (reloc_howto)): Sanity check howto_table index. Make r_index unsigned. (MY_swap_std_reloc_in): Make r_index unsigned. * aoutx.h (MOVE_ADDRESS): Sanity check symbol r_index. (aout_link_input_section_std): Make r_index unsigned. (aout_link_input_section_ext): Likewise. * i386lynx.c (MOVE_ADDRESS): Sanity check symbol r_index. (swap_ext_reloc_in, swap_std_reloc_in): Make r_index unsigned. * pdp11.c (MOVE_ADDRESS): Sanity check symbol r_index.
Diffstat (limited to 'bfd/pdp11.c')
-rw-r--r--bfd/pdp11.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 2c9fe0ae56..6429b43be1 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1862,7 +1862,8 @@ pdp11_aout_swap_reloc_out (bfd *abfd, arelent *g, bfd_byte *natptr)
if (r_extern) \
{ \
/* Undefined symbol. */ \
- cache_ptr->sym_ptr_ptr = symbols + r_index; \
+ if (r_index < bfd_get_symcount (abfd)) \
+ cache_ptr->sym_ptr_ptr = symbols + r_index; \
cache_ptr->addend = ad; \
} \
else \