Timezone logic bug in tzcode

Kang Seonghoon someone at mearie.org
Tue Jul 27 04:57:56 UTC 2010


While tracking a weird timezone bug present in Mac OS X and Darwin, I
determined the bug lies in the tzcode package. I'm not sure when the
bug first appeared but the affected versions include
tzcode2010{j,k}.tar.gz at the minimum.

The problematic part is settzname() function in localtime.c. When
USG_COMPAT flag is set it initializes timezone and altzone variables,
but since it (incorrectly) assumes the last non-DST rule is current it
assigns a wrong value to them. For a counter-example see Asia/Seoul
timezone: in this case timezone should be UTC+9:00 but set to UTC+8:00
instead. As far as I concerned the code is also present in FreeBSD and
Darwin, and in Darwin it produces a wrong result for strftime(3) call
as a consequence. (I'm going to report this issue to Apple

Kang Seonghoon

More information about the tz mailing list