This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch,libgfortran] Bug 61632 - memory corruption when writing formatted data
- From: Janne Blomqvist <blomqvist dot janne at gmail dot com>
- To: Jerry DeLisle <jvdelisle at charter dot net>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 14 Jul 2014 12:48:02 +0300
- Subject: Re: [patch,libgfortran] Bug 61632 - memory corruption when writing formatted data
- Authentication-results: sourceware.org; auth=none
- References: <53C2FC94 dot 4070008 at charter dot net>
On Mon, Jul 14, 2014 at 12:39 AM, Jerry DeLisle <jvdelisle@charter.net> wrote:
> Hi all,
>
> This bug was caused by an access to an invalid pointer offset to the format
> string. This was only a problem on the second error using the same format
> string. I suspect it has to do with caching the format strings. Regardless,
> the patch fixes this by using the fortran style string lengths to calculate the
> position in the string where the error occurs.
>
> Test case attached.
>
> Regression tested on x86-64.
>
> OK for trunk?
Ok, thanks.
>
> 2014-07-12 Jerry DeLisle <jvdelisle@gcc.gnu.org>
>
> PR libgfortran/61632
> * io/format.c (format_error): Avoid invalid string pointer by
> using the fortran string length values to generate error string.
--
Janne Blomqvist