Uninitialized memory access in zic

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2026-05-29T16:43:32Z
Lists: pgsql-hackers
Hi,

Valgrind on zic, run during the build, complains about a jump depending on
uninitialized memory.  A cursory check seems to confirm that, but I don't
understand the code at all:

valgrind --track-origins=yes src/timezone/zic -d src/timezone/timezone ../../../../../home/andres/src/postgresql/src/timezone/data/tzdata.zi

==3443847== Memcheck, a memory error detector
==3443847== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==3443847== Using Valgrind-3.25.1 and LibVEX; rerun with -h for copyright info
==3443847== Command: src/timezone/zic -d src/timezone/timezone ../../../../../home/andres/src/postgresql/src/timezone/data/tzdata.zi
==3443847==
==3443847== Conditional jump or move depends on uninitialised value(s)
==3443847==    at 0x4209F57: writezone (zic.c:2311)
==3443847==    by 0x420AC90: outzone (zic.c:3344)
==3443847==    by 0x420B65B: main (zic.c:853)
==3443847==  Uninitialised value was created by a heap allocation
==3443847==    at 0x404A818: malloc (vg_replace_malloc.c:446)
==3443847==    by 0x4206A3F: emalloc (zic.c:454)
==3443847==    by 0x4208E92: writezone (zic.c:2102)
==3443847==    by 0x420AC90: outzone (zic.c:3344)
==3443847==    by 0x420B65B: main (zic.c:853)
==3443847==

Greetings,

Andres Freund