proposed time zone package changes--Paraguay, core dump avoidance

Robert Elz kre at munnari.OZ.AU
Wed Feb 24 17:38:31 UTC 2010


    Date:        Wed, 24 Feb 2010 08:55:28 -0500 (EST)
    From:        Arthur David Olson <olsona at elsie.nci.nih.gov>
    Message-ID:  <201002241355.o1ODtS7P019553 at lecserver.nci.nih.gov>

  | ***************
  | *** 389,394 ****
  | --- 389,395 ----
  |   	nread = read(fid, u.buf, sizeof u.buf);
  |   	if (close(fid) < 0 || nread <= 0)
  |   		return -1;
  | + 	sp->goback = sp->goahead = FALSE;
  |   	for (stored = 4; stored <= 8; stored *= 2) {
  |   		int		ttisstdcnt;
  |   		int		ttisgmtcnt;

I think that one is still too late .. the init needs to be before anyy
possible return from tzload() so that we never return with uninitialised 
values.   Clearly here, it isn't before all returns ...

Of course, with the change from malloc() to calloc() this probably doesn't
really matter, as the state is all initialised anyway, but ...

I'd (really) make this the first executable line in tzload() - if we're
calling tzload() then (pretty much by definition) we don't want any state
that we might have had, we want whatever the new zone tells us (or if it
fails to tell us anything, we want a clean slate) - we don't want any remnants 
of the previous state left over from some earlier tzload (or tzload attempt).
With all that, I think having the init very early is the right answer.

kre




More information about the tz mailing list