/* ia64-opc.c -- Functions to access the compacted opcode table
- Copyright 1999, 2000, 2001, 2003, 2005, 2007, 2009, 2012
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2020 Free Software Foundation, Inc.
Written by Bob Manson of Cygnus Solutions, <manson@cygnus.com>
This file is part of the GNU opcodes library.
find_main_ent (short nameindex)
{
short start = 0;
- short end = sizeof (main_table) / sizeof (struct ia64_main_table);
+ short end = ARRAY_SIZE (main_table);
short i = (start + end) / 2;
if (nameindex < main_table[0].name_index
bitpos[currstatenum] = currbitnum;
- /* Skip opval[0] bits in the instruction. */
+ /* Skip opval[0] bits in the instruction. */
if (op & 0x40)
{
currbitnum -= opval[0];
}
- /* The value of the current bit being tested. */
+ if (currbitnum < 0)
+ currbitnum = 0;
+
+ /* The value of the current bit being tested. */
currbit = opcode & (((ia64_insn) 1) << currbitnum) ? 1 : 0;
next_op = -1;
if (next_op > 65535)
{
- abort ();
+ return -1;
}
/* Run through the list of opcodes to check, trying to find
const char *suffix;
short name_index;
+ if ((unsigned) place >= ARRAY_SIZE (main_table))
+ return NULL;
+
if (strlen (name) > 128)
{
return NULL;