* NEWS: Mention this.
* localtime.c (tzloadbody): Fix off-by-one errors in tests that
mistakenly caused the code to reject TZif files that actually fit.
Problem introduced in release 2014g, by my commit
13a277175c603cfb62ae5bdcf26e23faf5619ef1 dated 2014-08-19.
---
NEWS | 3 +++
localtime.c | 12 ++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/NEWS b/NEWS
index 71bd91e4..995507f0 100644
--- a/NEWS
+++ b/NEWS
@@ -43,6 +43,9 @@ Unreleased, experimental changes
outlandish but conforming UT offsets or leap second corrections,
has also been fixed. (Also reported by Naveed8951.)
+ localtime.c no longer rejects TZif files that exactly fit in its
+ internal structures, fixing off-by-one typos introduced in 2014g.
+
zic no longer generates a no-op transition when
simultaneous Rule and Zone changes cancel each other out.
This occurs in tzdata only in Asia/Tbilisi on 1997-03-30.
diff --git a/localtime.c b/localtime.c
index aa9b48ca..698f61bf 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1018,12 +1018,12 @@ tzloadbody(char const *name, struct state *sp, char
tzloadflags,
/* Although tzfile(5) currently requires typecnt to be nonzero,
support future formats that may allow zero typecnt
in files that have a TZ string and no transitions. */
- if (! (0 <= leapcnt && leapcnt < TZ_MAX_LEAPS
- && 0 <= typecnt && typecnt < TZ_MAX_TYPES
- && 0 <= timecnt && timecnt < TZ_MAX_TIMES
- && 0 <= charcnt && charcnt < TZ_MAX_CHARS
- && 0 <= ttisstdcnt && ttisstdcnt < TZ_MAX_TYPES
- && 0 <= ttisutcnt && ttisutcnt < TZ_MAX_TYPES))
+ if (! (0 <= leapcnt && leapcnt <= TZ_MAX_LEAPS
+ && 0 <= typecnt && typecnt <= TZ_MAX_TYPES
+ && 0 <= timecnt && timecnt <= TZ_MAX_TIMES
+ && 0 <= charcnt && charcnt <= TZ_MAX_CHARS
+ && 0 <= ttisstdcnt && ttisstdcnt <= TZ_MAX_TYPES
+ && 0 <= ttisutcnt && ttisutcnt <= TZ_MAX_TYPES))
return EINVAL;
datablock_size
= (timecnt * stored /* ats */
--
2.51.0