ubsan: arm: out of bounds array access

Message ID 20200120095002.GC4433@bubble.grove.modra.org
State New
Headers show
Series
  • ubsan: arm: out of bounds array access
Related show

Commit Message

Alan Modra Jan. 20, 2020, 9:50 a.m.
.inst 0x81bdfe9f

disassembles as
   0:	81bdfe9f 	ldaexdhi	pc, reg-names-std, [sp]

I'm quite sure "reg-names-std" isn't an ARM register.  Yes, I know
wrapping the 'T' value results in something that won't assemble..

	* arm-dis.c (print_insn_arm): Wrap 'T' value.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index c986b5897e..be2a93253b 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -10106,7 +10106,7 @@  print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
 			  case 'T':
 			    /* We want register + 1 when decoding T.  */
 			    if (*c == 'T')
-			      ++value;
+			      value = (value + 1) & 0xf;
 
 			    if (c[1] == 'u')
 			      {