Uninitialized memory access in zic
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
Andres Freund <andres@anarazel.de> writes:
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:
That code looks noticeably different in current upstream, so I suspect
Eggert and crew found and fixed this already. We should probably not
invest brain cells in tracking it down ourselves, but rather
prioritize updating our code to some more-recent tzcode version.
I've been meaning to do that for awhile now, will try to boost it
to the top of my to-do list.
regards, tom lane
So, it looks like the current upstream has removed the QT bug workaround.
It looks to me that the QT bug workaround
was unconditional but the initialization was gated on want_bloat(). I
agree the upstream seems fixed.
bg
On Fri, May 29, 2026 at 11:57 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Show quoted text
Andres Freund <andres@anarazel.de> writes:
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:That code looks noticeably different in current upstream, so I suspect
Eggert and crew found and fixed this already. We should probably not
invest brain cells in tracking it down ourselves, but rather
prioritize updating our code to some more-recent tzcode version.
I've been meaning to do that for awhile now, will try to boost it
to the top of my to-do list.regards, tom lane
On Fri, May 29, 2026 at 12:19:33PM -0500, Bryan Green wrote:
So, it looks like the current upstream has removed the QT bug workaround.
It looks to me that the QT bug workaround
was unconditional but the initialization was gated on want_bloat(). I
agree the upstream seems fixed.
Yeah, it looks like https://github.com/eggert/tz/commit/93132d18 might've
fixed it. That first appeared in 2021b.
--
nathan