<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><font face="monospace">I can demonstrate the bug. <br>
Please try</font></p>
<p><font face="monospace">zdump -c 1880,2010 -v Europe/London
Africa/Johannesburg<br>
in gdb debugger</font></p>
<p><font face="monospace">b tzload</font></p>
<p><font face="monospace">it stops 3 times. <br>
I let it run tzloadbody.</font></p>
<p><font face="monospace">Once it loaded Johannesburg, I look at
structure st</font></p>
<p><font face="monospace">p *sp<br>
$1 = {leapcnt = 0, timecnt = 6, typecnt = 5, charcnt = 9, goback
= false, <font color="#ff2600">goahead = true</font>, ...</font></p>
<p><font face="monospace">The goahead=true is incorrect.</font></p>
<p><font face="monospace">It should be </font><font
face="monospace" color="#ff2600">goahead=false</font></p>
<p><font face="monospace">This happens only when I load several
zones, i.e. Johannesburg after London.</font></p>
<p><font face="monospace">None of the compile options like -std=c99
or -std=gnu11 fixes that issue on my RHEL 7 compiler gcc version
4.8.5.</font></p>
<p><font face="monospace">I also tried compiler </font><font
face="monospace">gcc version 9.3.1, same problem.</font></p>
<p></p>
<p><font face="monospace">When I compile on RHEL 9 with gcc version
11.4.1 the problem does not appear. <br>
it gives goahead=false</font></p>
<p><font face="monospace">The patch memset(&ls, 0, sizeof(ls));
fixes the issue for </font><font face="monospace">gcc version
4.8.5 and </font><font face="monospace"></font><font
face="monospace">gcc version 9.3.1.</font></p>
<p><font face="monospace"><br>
</font></p>
<p><font face="monospace"><br>
</font></p>
<div class="moz-cite-prefix">On 23.11.23 19:32, Alois Treindl via tz
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:6b01f610-ddb9-45e8-b6e3-2db90d3819d1@astro.ch">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>I have observed occasional crashes in localtime.c in the
current github version.</p>
<p>In one of my applications, localtime() is called multiple times
for several zones.</p>
<p>The condition when the segmentation fault appears are herd to
reproduce or demonstrate.</p>
<p>This patch in function tzload() however solves the issue:</p>
<p>--- localtime.c 2023-11-16 20:18:01.904577574 +0100<br>
+++ a/localtime.c 2023-11-23 19:22:21.062249899 +0100<br>
@@ -769,6 +769,7 @@<br>
}<br>
#else<br>
union local_storage ls;<br>
+ memset(&ls, 0, sizeof(ls));<br>
return tzloadbody(name, sp, doextend, &ls);<br>
#endif<br>
}<br>
</p>
</blockquote>
</body>
</html>