This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix -fsanitize=address on unreadable inferior strings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]