Replace xmalloc/xfree with vector in jit.c
[deliverable/binutils-gdb.git] / opcodes / d30v-dis.c
index f8783430809057a85abe8ff96391009b83bc6edc..d2e0caa39d73372ac1ab57fa20beaed9fb5049c9 100644 (file)
@@ -1,5 +1,5 @@
 /* Disassemble D30V instructions.
-   Copyright (C) 1997-2018 Free Software Foundation, Inc.
+   Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
@@ -23,6 +23,7 @@
 #include "opcode/d30v.h"
 #include "disassemble.h"
 #include "opintl.h"
+#include "libiberty.h"
 
 #define PC_MASK 0xFFFFFFFF
 
@@ -124,7 +125,8 @@ print_insn (struct disassemble_info *info,
 {
   int val, opnum, need_comma = 0;
   struct d30v_operand *oper;
-  int i, match, opind = 0, need_paren = 0, found_control = 0;
+  int i, match, need_paren = 0, found_control = 0;
+  unsigned int opind = 0;
 
   (*info->fprintf_func) (info->stream, "%s", insn->op->name);
 
@@ -153,7 +155,8 @@ print_insn (struct disassemble_info *info,
 
   (*info->fprintf_func) (info->stream, "\t");
 
-  while ((opnum = insn->form->operands[opind++]) != 0)
+  while (opind < ARRAY_SIZE (insn->form->operands)
+        && (opnum = insn->form->operands[opind++]) != 0)
     {
       int bits;
 
@@ -313,7 +316,9 @@ print_insn (struct disassemble_info *info,
          (*info->fprintf_func) (info->stream, "0x%x", val);
        }
       /* If there is another operand, then write a comma and space.  */
-      if (insn->form->operands[opind] && !(found_control && opind == 2))
+      if (opind < ARRAY_SIZE (insn->form->operands)
+         && insn->form->operands[opind]
+         && !(found_control && opind == 2))
        need_comma = 1;
     }
   if (need_paren)
This page took 0.023717 seconds and 4 git commands to generate.