Commit: Fix illegal memory access in xgate disassembler

Message ID 87sgncnc42.fsf@redhat.com
State New
Headers show
Series
  • Commit: Fix illegal memory access in xgate disassembler
Related show

Commit Message

Nick Clifton Oct. 28, 2019, 3:06 p.m.
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.

Patch

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;
         }