This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix the handling of string precision in pretty printer (PR 81586)
- From: Jeff Law <law at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 2 Aug 2017 13:03:56 -0600
- Subject: Re: [PATCH] fix the handling of string precision in pretty printer (PR 81586)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 87AD9155C1
- References: <388ea759-1c59-9fad-5006-1f6f70c01378@gmail.com>
On 07/27/2017 05:29 PM, Martin Sebor wrote:
> The pretty printer treats precision in %s directives as a request
> to print exactly as many characters from the string argument when
> what precision normally (in C) means is the maximum number of
> characters to read from the string. It doesn't mean to read
> past the terminating NUL.
>
> The attached patch fixes that. Tested on x86_64-linux.
>
> Martin
>
> gcc-81586.diff
>
>
> PR c++/81586 - valgrind error in output_buffer_append_r with -Wall
>
> gcc/ChangeLog:
>
> PR c++/81586
> * pretty-print.c (pp_format): Correct the handling of %s precision.
OK.
jeff