This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Commit: Fix potential undefined behaviour in RX disassembler
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org
- Date: Fri, 25 Oct 2019 16:09:56 +0100
- Subject: Commit: Fix potential undefined behaviour in RX disassembler
Hi Guys,
I am applying the patch below to fix a problem detected by the
undefined behaviour sanitizer. The address calculation has the
potential to be undefined since "opcode.op + *s" is beyond the end
of the opcode.op array.
Cheers
Nick
opcodes/ChangeLog
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.
diff --git a/opcodes/rx-dis.c b/opcodes/rx-dis.c
index c84f7c5d60..80144bb612 100644
--- a/opcodes/rx-dis.c
+++ b/opcodes/rx-dis.c
@@ -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)
c