Re: [PATCH] Fix buffer underrun in i386-dis.c.

Pedro Alves
2014-01-09T19:03:34Z

On 01/09/2014 06:31 PM, H.J. Lu wrote:
> On Thu, Jan 9, 2014 at 10:26 AM, Roland McGrath <mcgrathr@google.com> wrote:
>> When disassembling any instruction without a REX prefix, the print_insn
>> function touches all_prefixes[-1]. This is usually harmless in most
>> builds, because the word preceding all_prefixes will probably be the
>> last_seg_prefix variable and it was usually zero already. But in some
>> kinds of builds, all buffer underruns are caught and cause a crash.
>>
>> AFAICT the obvious local workaround is in fact the proper fix. In the
>> similar cases nearby, there is a PREFIX_FOO bit in the "prefixes" bitmask
>> that guards use of last_foo_prefix. But there is no such bit for the REX
>> prefixes. We could test "rex != 0" instead, I suppose.
>>
>> OK for trunk and binutils-2.24 branch and gdb-7.7 branch?
>
> OK for trunk and binutils-2.24 branch.

In that case, OK for gdb-7.7 too.

--
Pedro Alves