This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: Fix potential negative shift in IA64 disassembler
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Tue, 29 Oct 2019 10:01:19 +0000
- Subject: Commit: Fix potential negative shift in IA64 disassembler
Hi Guys,
I am applying the patch below to stop a left shift by a negative value
that can occur in the IA64 disassembler.
Cheers
Nick
opcodes/ChangeLog
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.
diff --git a/opcodes/ia64-opc.c b/opcodes/ia64-opc.c
index 5aa1198ec5..ba60f8a782 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