[tz] [PROPOSED PATCH 2/5] * localtime.c (tzload): Reject files with out-of-order transitions.

Paul Eggert eggert at cs.ucla.edu
Tue Aug 19 19:52:39 UTC 2014


---
 localtime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/localtime.c b/localtime.c
index a1e6601..a3d6263 100644
--- a/localtime.c
+++ b/localtime.c
@@ -408,7 +408,9 @@ tzload(register const char *name, register struct state *const sp,
 			  time_t attime
 			    = ((TYPE_SIGNED(time_t) ? at < time_t_min : at < 0)
 			       ? time_t_min : at);
-			  if (timecnt && sp->ats[timecnt - 1] == attime) {
+			  if (timecnt && attime <= sp->ats[timecnt - 1]) {
+			    if (attime < sp->ats[timecnt - 1])
+			      goto oops;
 			    sp->types[i - 1] = 0;
 			    timecnt--;
 			  }
-- 
1.9.1



More information about the tz mailing list