From dee334510fe3940456bd282fc9da9ff9257d8483 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 28 Oct 2019 15:06:32 +0000 Subject: [PATCH] Prevent an illegal memory access in the xgate disassembler. * xgate-dis.c (print_insn): Fix decoding of the XGATE_OP_DYA operand. --- opcodes/ChangeLog | 5 +++++ opcodes/xgate-dis.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 74f1db2aa6f..66df91109e2 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,8 @@ +2019-10-28 Nick Clifton + + * xgate-dis.c (print_insn): Fix decoding of the XGATE_OP_DYA + operand. + 2019-10-25 Nick Clifton * rx-dis.c (print_insn_rx): Use parenthesis to ensure correct diff --git a/opcodes/xgate-dis.c b/opcodes/xgate-dis.c index f7ae013212a..ee88bf9c328 100644 --- a/opcodes/xgate-dis.c +++ b/opcodes/xgate-dis.c @@ -169,8 +169,8 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) } else if (!strcmp (decodePTR->opcodePTR->constraints, XGATE_OP_DYA)) { - operandOne = ripBits (&operMaskReg, 3, opcodePTR, raw_code); - operandTwo = ripBits (&operMaskReg, 3, opcodePTR, raw_code); + operandOne = ripBits (&operMaskReg, 3, decodePTR->opcodePTR, raw_code); + operandTwo = ripBits (&operMaskReg, 3, decodePTR->opcodePTR, raw_code); ( *info->fprintf_func)(info->stream, " R%x, R%x", operandOne, operandTwo); } @@ -259,7 +259,7 @@ print_insn (bfd_vma memaddr, struct disassemble_info* info) else { (*info->fprintf_func)(info->stream, " unhandled mode %s", - opcodePTR->constraints); + decodePTR->opcodePTR->constraints); } perviousBin = raw_code; } -- 2.30.2