From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8491 invoked by alias); 19 Aug 2014 14:16:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 8479 invoked by uid 89); 19 Aug 2014 14:16:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 19 Aug 2014 14:16:13 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7JEG8rY005824 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 19 Aug 2014 10:16:09 -0400 Received: from host2.jankratochvil.net (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7JEG3AT011980 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 19 Aug 2014 10:16:07 -0400 Date: Tue, 19 Aug 2014 14:16:00 -0000 From: Jan Kratochvil To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [patch] Fix -fsanitize=address on unreadable inferior strings Message-ID: <20140819141601.GA31077@host2.jankratochvil.net> References: <20140818192747.GA23790@host2.jankratochvil.net> <20140819065422.GE1773@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140819065422.GE1773@adacore.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-08/txt/msg00351.txt.bz2 On Tue, 19 Aug 2014 08:54:22 +0200, Joel Brobecker wrote: > > gdb/ > > 2014-08-18 Jan Kratochvil > > > > 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