diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-02-18 09:48:08 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-02-21 20:33:23 +0000 |
commit | 245844372d7e4dd7c633816b67c0da59be75b812 (patch) | |
tree | 0ebc6365ad6f9b56933846c9d15dae49dec64934 | |
parent | e257a38de4d57bb1884d5c7196131a81192d5252 (diff) | |
download | src-245844372d7e4dd7c633816b67c0da59be75b812.tar.gz src-245844372d7e4dd7c633816b67c0da59be75b812.zip |
tzcode: Fix overflow handling in TZ parser.
Obtained from: upstream 9fc11a27
MFC after: 1 week
PR: 276281
(cherry picked from commit 1365bb722af1365baee6ea1e3d44917533908d53)
-rw-r--r-- | contrib/tzcode/localtime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index 2b33cce1ec50..25a65385256b 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -1246,11 +1246,13 @@ tzparse(const char *name, struct state *sp, struct state const *basep) do { int_fast32_t yearsecs = year_lengths[isleap(yearbeg - 1)] * SECSPERDAY; + time_t janfirst1 = janfirst; yearbeg--; - if (increment_overflow_time(&janfirst, -yearsecs)) { + if (increment_overflow_time(&janfirst1, -yearsecs)) { janoffset = -yearsecs; break; } + janfirst = janfirst1; } while (atlo < janfirst && EPOCH_YEAR - YEARSPERREPEAT / 2 < yearbeg); |