Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix -fsanitize=address on unreadable inferior strings
Date: Tue, 19 Aug 2014 14:16:00 -0000	[thread overview]
Message-ID: <20140819141601.GA31077@host2.jankratochvil.net> (raw)
In-Reply-To: <20140819065422.GE1773@adacore.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


  reply	other threads:[~2014-08-19 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 19:27 Jan Kratochvil
2014-08-19  6:54 ` Joel Brobecker
2014-08-19 14:16   ` Jan Kratochvil [this message]
2014-08-19 20:56   ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140819141601.GA31077@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox