This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Fix -fsanitize=address on unreadable inferior strings
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 19 Aug 2014 16:16:01 +0200
- Subject: Re: [patch] Fix -fsanitize=address on unreadable inferior strings
- Authentication-results: sourceware.org; auth=none
- References: <20140818192747 dot GA23790 at host2 dot jankratochvil dot net> <20140819065422 dot GE1773 at adacore dot com>
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