x86: correct decoding of nop/reserved space (0f18 ... 0x1f)

Alan Modra amodra@gmail.com
Fri Mar 12 00:45:19 GMT 2021


When assembling this testcase then disassembling
 .byte 0x66, 0xf2, 0x0f, 0x1c, 0x20
asan reports
i386-dis.c:9786:14: runtime error: index -1 out of bounds for type 'int [14]'

	* i386-dis.c (print_insn <PREFIX_IGNORED>): Correct typo.

diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index 2985e8d441..4e3304d4a4 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -9783,7 +9783,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
 	 origins in all_prefixes.  */
       used_prefixes &= ~PREFIX_OPCODE;
       if (last_data_prefix >= 0)
-	all_prefixes[last_repz_prefix] = 0x66;
+	all_prefixes[last_data_prefix] = 0x66;
       if (last_repz_prefix >= 0)
 	all_prefixes[last_repz_prefix] = 0xf3;
       if (last_repnz_prefix >= 0)

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list