Skip to content

Commit

Permalink
tzcode: Fix overflow handling in TZ parser.
Browse files Browse the repository at this point in the history
Obtained from:	upstream 9fc11a27
MFC after:	1 week
PR:		276281
  • Loading branch information
dag-erling committed Feb 18, 2024
1 parent 078a311 commit 1365bb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contrib/tzcode/localtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 1365bb7

Please sign in to comment.