[tz] localtime crash and fix

Paul Eggert eggert at cs.ucla.edu
Fri Nov 24 22:14:00 UTC 2023


On 2023-11-24 08:22, Alois Treindl via tz wrote:
> The use of union to save memory is dangerous, in my opinion. There is no 
> need in today's machines to save a few kilobytes of RAM for a process.
> Not even in embedded software for watches.

When the memory is on the stack it still makes sense in some cases to 
save even a few kilobytes of RAM, as highly-threaded apps often have 
surprisingly small stacks. And anyway, the union has nothing to do with 
this particular bug.

Thanks for reporting the problem. I installed the attached patches. The 
first patch fixes the bug; the second is a minor cleanup I noticed while 
in the neighborhood.

The first patch clears just two slots rather than the entire struct, to 
avoid masking other errors.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-bug-introduced-by-fix-for-unusual-TZif.patch
Type: text/x-patch
Size: 1514 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20231124/2dadecfe/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Simplify-tzparse.patch
Type: text/x-patch
Size: 1313 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20231124/2dadecfe/attachment-0001.bin>


More information about the tz mailing list