[tz] Checked arithmetic bug

Dag-Erling Smørgrav des at des.no
Fri Feb 16 13:23:26 UTC 2024


In at least one instance around line 1187 of localtime.c, the code
assumes that increment_overflow_time() does not modify the result if the
operation overflowed, but that is not true when using C23 checked
arithmetic.

Details: https://bugs.freebsd.org/276281, particularly comment 11.

One possible solution is attached.  I'm not overly fond of it because it
penalizes the common case, but it was easier than trying to understand
and reformulate the loop in tzparse().

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-increment_overflow-preserve-the-original-value-on-ov.patch
Type: text/x-patch
Size: 1738 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20240216/ea5fa140/attachment.bin>


More information about the tz mailing list