zdump -v crashes with 64-bit time_t

Paul Eggert eggert at CS.UCLA.EDU
Tue Jun 15 06:53:49 UTC 2004


Ken Pizzini <"tz."@explicate.org> writes:

> No, that patch wasn't right either: it did protect the asctime()
> calls fine, but it still left zdump.c with many potential dereferences
> of NULL localtime() result pointers.

The patch that I submitted about an hour after your message fixes
those null-dereferencing problems _if_ one assumes that localtime
succeeds in a contiguous region, i.e., that if localtime succeeds on
both T1 and T2, and T1 <= T <= T2, then localtime succeeds on T.

Hmm, I just now realized that this assumption isn't quite valid in
general, because a daylight-saving transition could occur at the end
if the year (INT_MAX - 1900), which means that localtime might succeed
in a discontiguous region.

I think the "right way" to fix this is to redo zdump so that a
discontinuity is reported if localtime succeeds at time T but fails at
time T+1, or vice versa.  If Arthur likes this idea I can code up a
solution along those lines.



More information about the tz mailing list