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: Aharon Robbins
Subject: Re: gawk: other double free(_wstr)
Date: Tue, 16 Jan 2007 22:53:22 +0200

Hi Andy.

> On Mon, Jan 15, 2007 at 10:20:39PM +0200, Aharon Robbins wrote:
> > Karel scared me a bit.  I've rethought things, and the point of free_wstr,
> > _now_, is to make sure that the wstptr field is zero if WSTRCUR is not set.
>
> I guess I'm being dense, but I simply don't understand why the value of wstptr
> matters at all if WSTRCUR is not set.  As far as I can tell, the code should
> not even think about using the value of wstptr unless WSTRCUR is set.  So it
> seems to me that it's just a waste of cycles to bother to zero out wstptr if
> WSTRCUR is not set.  What am I missing?

Basically, Karel said it. At this point it's extra paranoia. That field
will be zero the next time a freed node is reallocated for another
use. The overhead of a function call probably dwarfs the cycles of the
extra two assignments to zero.

At this point, unless someone can demonstrate a problem, I'd prefer to
leave things the way they are now. I will probably add Karel's assertion,
too.

It's taken close to two years to get the subtleties of this stuff worked
out; this seems to indicate that being paranoid is worthwhile.

Yes, the address@hidden&*() union is the real problem, but until I can rewrite
gawk in C++ and use inheritance and type safe classes, we're gonna have
to make do.

Thanks!

Arnold




reply via email to

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