[tz] [PROPOSED] Fix unlikely conversion bug in zic

Paul Eggert eggert at cs.ucla.edu
Sat Nov 5 03:01:07 UTC 2022


* zic.c (puttzcode): Arg is zic_t, not int_fast32_t.  This fixes a
portability bug on platforms where int_fast32_t is a 32-bit ones’
complement or signed-magnitude integer, and where the argument is
-2**31 before conversion to int_fast32_t.  Although I don’t know
of any such platforms, the C standard allows them.
---
 zic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zic.c b/zic.c
index d8bdbb96..548c1c5f 100644
--- a/zic.c
+++ b/zic.c
@@ -2216,7 +2216,7 @@ convert64(uint_fast64_t val, char *buf)
 }
 
 static void
-puttzcode(const int_fast32_t val, FILE *const fp)
+puttzcode(zic_t val, FILE *fp)
 {
 	char	buf[4];
 
-- 
2.37.2



More information about the tz mailing list