From add92896046c5ca099ce87c05514018b924aa8a9 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 24 Nov 2023 13:57:09 -0800
Subject: [PATCH 1/2] Fix bug introduced by fix for unusual TZif

Problem reported by Alois Treindl in:
https://mm.icann.org/pipermail/tz/2023-November/033257.html
* localtime.c (tzparse): Do not assume sp->goback and sp->goahead
are initialized.  This fixes a bug inadvertantly created by the
2023-10-13 patch.
---
 NEWS        | 3 ++-
 localtime.c | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9fb12b9e..b7884c2d 100644
--- a/NEWS
+++ b/NEWS
@@ -29,7 +29,8 @@ Unreleased, experimental changes
 
     localtime.c no longer mishandles TZif files that contain a single
     transition into a DST regime.  Previously, it incorrectly assumed
-    DST was in effect before the transition too.
+    DST was in effect before the transition too.  (Thanks to Alois
+    Treindl for debugging help.)
 
     zic no longer mishandles data for Palestine after the year 2075.
     Previously, it incorrectly omitted post-2075 transitions that are
diff --git a/localtime.c b/localtime.c
index 1f6193a4..9bb4b2bf 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1115,6 +1115,7 @@ tzparse(const char *name, struct state *sp, struct state const *basep)
 	}
 	if (0 < sp->leapcnt)
 	  leaplo = sp->lsis[sp->leapcnt - 1].ls_trans;
+	sp->goback = sp->goahead = false;
 	if (*name != '\0') {
 		if (*name == '<') {
 			dstname = ++name;
-- 
2.40.1

