Skip to content

reject out-of-range minutes in timezone offset parsing#1336

Merged
TristonianJones merged 1 commit into
google:masterfrom
alhudz:tz-offset-minutes-range
Jun 12, 2026
Merged

reject out-of-range minutes in timezone offset parsing#1336
TristonianJones merged 1 commit into
google:masterfrom
alhudz:tz-offset-minutes-range

Conversation

@alhudz

@alhudz alhudz commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Repro: timestamp(...).getMinutes("+00:99"), getMinutes("-00:90"), or a signed minute such as getMinutes("+05:-30").
Cause: timeZone parses the minute field of a numeric ±HH:MM offset with a bare strconv.Atoi and never bounds it, so a minute >= 60 (or a negative/signed one) is accepted and shifts the resolved local time by an arbitrary amount across every getX(tz) accessor.
Fix: reject a parsed minute outside [0, 59] in the callee before the offset is computed. Valid offsets like -08:30 and the existing +23:00 hour case are unaffected.

@TristonianJones

Copy link
Copy Markdown
Collaborator

/gcbrun

@TristonianJones TristonianJones merged commit 783267d into google:master Jun 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants