This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb 8.0 "lazy_string" exception "Length is larger than array size"
- From: Pedro Alves <palves at redhat dot com>
- To: Phil Muldoon <pmuldoon at redhat dot com>, Michael Stahl <mstahl at redhat dot com>, gdb at gnu dot org, Doug Evans <dje at google dot com>, Doug Evans <xdje42 at gmail dot com>
- Date: Tue, 26 Sep 2017 11:30:26 +0100
- Subject: Re: gdb 8.0 "lazy_string" exception "Length is larger than array size"
- Authentication-results: sourceware.org; auth=none
- References: <oqbdtj$nvc$1@blaine.gmane.org> <a8fbe6d5-08f8-47ee-75c1-62a9b380d337@redhat.com>
On 09/26/2017 08:56 AM, Phil Muldoon wrote:
> On 25/09/17 18:20, Michael Stahl wrote:
> This code was added at 34b433203b5 by Doug Evans and
> it was noted it was a bug. I've not sure, though, fixing this bug
> may have had unintended consequences. I've CC'd Doug on the patch
> and maybe he could comment further.
We could perhaps decide to special case trailing arrays of
lengths 0 and 1 (i.e., let the caller request more elements than
declared), assuming they're being used as the trailing array
idiom, similarly to how gcc also has special concessions for those.
I don't know off hand whether its easy for the gdb code in question
to tell whether the array is the last field of a struct, though
I'd assume not.
If you want to ignore the array's declared length, I think you can
always decay 'buffer' to a pointer and work with that, and then GDB
won't have a length to validate.
Thanks,
Pedro Alves