Commit: Fix illegal memory access in xgate disassembler

Nick Clifton nickc@redhat.com
Mon Oct 28 15:06:00 GMT 2019


Hi Guys,

  I am applying the patch below to fix an illegal memory access in the
  xgate disassembler.  The opcodePTR variable was used in a loop at the
  start of the print_insn() function, but after that it is never reset
  and contains a pointer to an illegal address.

Cheers
  Nick

binutils/ChangeLog
2019-10-28  Nick Clifton  <nickc@redhat.com>

	* xgate-dis.c (print_insn): Fix decoding of the XGATE_OP_DYA
	operand.

diff --git a/opcodes/xgate-dis.c b/opcodes/xgate-dis.c
index f7ae013212..ee88bf9c32 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;
         }



More information about the Binutils mailing list