bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk: other double free(_wstr)


From: Karel Zak
Subject: Re: gawk: other double free(_wstr)
Date: Fri, 12 Jan 2007 15:43:48 +0100
User-agent: Mutt/1.5.11

On Fri, Jan 12, 2007 at 09:14:17AM -0500, Andrew J. Schorr wrote:
> On Fri, Jan 12, 2007 at 01:52:28PM +0100, Karel Zak wrote:
> > On Fri, Jan 12, 2007 at 02:29:34PM +0200, Aharon Robbins wrote:
> > > I don't get this with my current sources, which should be appearing
> > > on the Savannah CVS archive within an hour or two.  Valgrind is happy.
> > 
> ...
> > 
> >  $ echo -e "AAA BBX\nAAA BBY" | ./gawk ' /^AAA BB/ { x = substr($2,
> >  1); $1 = "FOO"; print $0 }'
> > 
> 
> I think there may be a silly confusion here.  If you run csh,
> then the command 'echo -e "AAA BBX\nAAA BBY"' gives this:
> 
>    csh: echo -e "AAA BBX\nAAA BBY" 
>    -e AAA BBX
>    AAA BBY
> 
> whereas with bash, one gets this:
> 
>    bash-3.00$ echo -e "AAA BBX\nAAA BBY"
>    AAA BBX
>    AAA BBY

 Oops, yes. There must be two lines. The original report is:
 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=222080

 but it's not one line test.

>> 
> I think the fix may be simply to turn off the WSTRCUR flag,
> as Karel suggested:
> 
> --- field.c   10 Jan 2006 20:04:21 -0000      1.3
> +++ field.c   12 Jan 2007 14:01:01 -0000
> @@ -206,7 +197,7 @@ rebuild_record()
>                               }
>                       } else {
>                               *n = *(fields_arr[i]);
> -                             n->flags &= ~(MALLOC|TEMP|PERM|STRING);
> +                             n->flags &= ~(MALLOC|TEMP|PERM|STRING|WSTRCUR);
>                       }
>  
>                       n->stptr = cops;

 I think more robust will be zeroize all wstptr stuff. May be create a
 new function zeroize_wstr(). I think there is more places where we
 can use it.

    Karel

-- 
 Karel Zak  <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]