aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-10-29 10:01:27 +0000
committerNick Clifton <nickc@redhat.com>2019-10-29 10:01:27 +0000
commit993a00a986d0795a3cbb7a2dd0c640d8e6d66734 (patch)
tree1a1718c73f3356b40337e859b79adbfb109d190e
parent66a66a17f489a4ffc614a31855e8d6f516e24640 (diff)
downloadgdb-993a00a986d0795a3cbb7a2dd0c640d8e6d66734.zip
gdb-993a00a986d0795a3cbb7a2dd0c640d8e6d66734.tar.gz
gdb-993a00a986d0795a3cbb7a2dd0c640d8e6d66734.tar.bz2
Prevent a left shift by a negative value when disassembling IA64 binaries.
* ia64-opc.c (locate_opcode_ent): Prevent a negative shift when locating the bit to be tested.
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/ia64-opc.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index d83b5ba..d596729 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,10 @@
2019-10-29 Nick Clifton <nickc@redhat.com>
+ * ia64-opc.c (locate_opcode_ent): Prevent a negative shift when
+ locating the bit to be tested.
+
+2019-10-29 Nick Clifton <nickc@redhat.com>
+
* s12z-dis.c (opr_emit_disassembly): Check for illegal register
values.
(shift_size_table): Use a fixed size defined as S12Z_N_SIZES.
diff --git a/opcodes/ia64-opc.c b/opcodes/ia64-opc.c
index 5aa1198..ba60f8a 100644
--- a/opcodes/ia64-opc.c
+++ b/opcodes/ia64-opc.c
@@ -372,13 +372,16 @@ locate_opcode_ent (ia64_insn opcode, enum ia64_insn_type type)
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;
@@ -463,7 +466,7 @@ locate_opcode_ent (ia64_insn opcode, enum ia64_insn_type type)
if (next_op > 65535)
{
- abort ();
+ return -1;
}
/* Run through the list of opcodes to check, trying to find