[tz] Bug in 2022f version of zic.c
Tim McBrayer
TMcBrayer at ABINITIO.com
Mon Nov 7 14:37:18 UTC 2022
Paul,
Both patches work as designed on Linux and AIX for me. I have reports that
our z/OS build has hit the same issue. That one will take some time for
the fix to percolate through the build system to validate it; I don't have
easy individual access to z/OS.
---
Tim McBrayer
From: "Paul Eggert" <eggert at cs.ucla.edu>
To: "Guy Harris" <gharris at sonic.net>, "Tim McBrayer"
<TMcBrayer at ABINITIO.com>
Cc: "Time zone mailing list" <tz at iana.org>
Date: 11/04/2022 09:25 PM
Subject: Re: [tz] Bug in 2022f version of zic.c
On 2022-11-04 16:11, Guy Harris via tz wrote:
> In what cases in zic is emalloc() - or erealloc() - called with 0 as the
size argument?
It's when zic sees a Zone with no continuation lines. I didn't notice
the bug in testing, since I don't test with AIX. The portability bug was
triggered by the removal of the Qt bug workaround in tzcode 2022f, which
when combined with the -bslim option introduced in tzcode 2019b means
that zic can generate TZif files with no time transitions.
Thanks for reporting the bug, Tim. I installed the first attached patch;
please give it a try. I think this fixes the only place that might call
malloc(0) or realloc(p, 0).
It's unfortunate that the C standard allows malloc to return NULL on
success, as this complicates error checking. Of course zic.c should be
portable even to platforms that exploit this glitch in C.
> (ecpyalloc() - which should probably be called estrdup() to make it
clearer that it's "strdup() with quit on out-of-memory"
Good suggestion, thanks. I installed the attached second patch to do that.
[attachment "0001-Port-to-AIX-6.1-malloc.patch" deleted by Tim
McBrayer/AbInitio] [attachment "0002-Rename-ecpyalloc-to-estrdup.patch"
deleted by Tim McBrayer/AbInitio]
NOTICE from Ab Initio: This email (including any attachments) may contain information that is subject to confidentiality obligations or is legally privileged, and sender does not waive confidentiality or privilege. If received in error, please notify the sender, delete this email, and make no further use, disclosure, or distribution.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mm.icann.org/pipermail/tz/attachments/20221107/2ebcc2ae/attachment.html>
More information about the tz
mailing list