Re: gdb 8.0 "lazy_string" exception "Length is larger than array size"

Pedro Alves <[email protected]>
Newsgroups gmane.comp.gdb.devel,gmane.comp.gdb.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.