x86: correct decoding of nop/reserved space (0f18 ... 0x1f)
Jan Beulich
jbeulich@suse.com
Fri Mar 12 07:11:39 GMT 2021
On 12.03.2021 01:45, Alan Modra wrote:
> 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)
Urgh - what a bad copy-and-paste mistake. Thanks for spotting/fixing.
I wonder why this didn't break one of the test cases.
Jan
More information about the Binutils
mailing list