Fix potential undefined behaviour in the RX disassembler.
authorNick Clifton <nickc@redhat.com>
Fri, 25 Oct 2019 15:10:04 +0000 (16:10 +0100)
committerNick Clifton <nickc@redhat.com>
Fri, 25 Oct 2019 15:10:04 +0000 (16:10 +0100)
* rx-dis.c (print_insn_rx): Use parenthesis to ensure correct
access to opcodes.op array element.

opcodes/ChangeLog
opcodes/rx-dis.c

index 4213fba71d6b6014fe580fad9dde26f4d390ce7d..74f1db2aa6f8097ac1586fe00f3be9e7cdaf2bc4 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-25  Nick Clifton  <nickc@redhat.com>
+
+       * rx-dis.c (print_insn_rx): Use parenthesis to ensure correct
+       access to opcodes.op array element.
+
 2019-10-23  Nick Clifton  <nickc@redhat.com>
 
        * rx-dis.c (get_register_name): Fix spelling typo in error
index c84f7c5d603dbcd7d5b39446f90566bd25e52f52..80144bb6127d9034999394f817fb2d2340e30ca0 100644 (file)
@@ -319,7 +319,7 @@ print_insn_rx (bfd_vma addr, disassemble_info * dis)
            case '0':
            case '1':
            case '2':
-             oper = opcode.op + *s - '0';
+             oper = opcode.op + (*s - '0');
              if (do_size)
                {
                  if (oper->type == RX_Operand_Indirect || oper->type == RX_Operand_Zero_Indirect)