This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix buffer underrun in i386-dis.c.
- From: Pedro Alves <palves at redhat dot com>
- To: Roland McGrath <mcgrathr at google dot com>
- Cc: "H.J. Lu" <hjl dot tools at gmail dot com>, "binutils at sourceware dot org" <binutils at sourceware dot org>, GDB <gdb-patches at sourceware dot org>, Bradley Nelson <bradnelson at google dot com>
- Date: Thu, 09 Jan 2014 19:03:24 +0000
- Subject: Re: [PATCH] Fix buffer underrun in i386-dis.c.
- Authentication-results: sourceware.org; auth=none
- References: <CAB=4xhooGrDed7eSXbPOYZjx57-HOQKCQq9wwEphWAgL0=Q8Hg at mail dot gmail dot com> <CAMe9rOrf6V5g5DL7-7McsLL=L+F3AkUjZj=b-WPOGKEmf+OV0w at mail dot gmail dot com>
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