[patch] Fix -fsanitize=address on unreadable inferior strings
Jan Kratochvil
jan.kratochvil@redhat.com
Tue Aug 19 14:16:00 GMT 2014
On Tue, 19 Aug 2014 08:54:22 +0200, Joel Brobecker wrote:
> > gdb/
> > 2014-08-18 Jan Kratochvil <jan.kratochvil@redhat.com>
> >
> > Fix -fsanitize=address on unreadable inferior strings.
> > * valprint.c (val_print_string): Fix access before BUFFER.
>
> LGTM. I actually don't see why this wouldn't be a possible bug.
> Couldn't LEN be 0, in which case BYTES_READ would be zero, making
> WIDTH > BYTES_READ?
If LEN == 0 then the whole GDB code ignores FOUND_NUL, therefore it is
irrelevant for this patch. Besides that if LEN == 0 then ERRCODE == 0,
therefore FORCE_ELLIPSIS == 0.
A sort of bug is that if the start of string memory is unreadable GDB randomly
may attempt to read the same byte/character second time (failing again).
So it is sort of a performance bug.
(Although such read of the same memory should be cached which I did not check
now if it really is.)
I will therefore check it in.
Jan
More information about the Gdb-patches
mailing list