aboutsummaryrefslogtreecommitdiff
path: root/src/time/zoneinfo.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-02-25 10:01:56 -0800
committerDmitri Shuralyov <dmitshur@golang.org>2021-03-01 21:51:21 +0000
commit6bb96000b3215a84d0a5193e387cf809d2fa2800 (patch)
treec846bd1a8b28d2aaa241f1c7b0001de1401ccd5c /src/time/zoneinfo.go
parent4fda89d4201fc9f0c1e192bbcc95dd8d660e9122 (diff)
downloadgo-6bb96000b3215a84d0a5193e387cf809d2fa2800.tar.gz
go-6bb96000b3215a84d0a5193e387cf809d2fa2800.zip
[release-branch.go1.15] time: correct unusual extension string cases
This fixes two uncommon cases. First, the tzdata code permits timezone offsets up to 24 * 7, although the POSIX TZ parsing does not. The tzdata code uses this to specify a day of week in some cases. Second, we incorrectly rejected a negative time offset for when a time zone change comes into effect. For #44385 Fixes #44617 Change-Id: I5f2efc1d385e9bfa974a0de3fa81e7a94b827602 Reviewed-on: https://go-review.googlesource.com/c/go/+/296392 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit d9fd38e68ba00a51c2c7363150688d0e7687ef84) Reviewed-on: https://go-review.googlesource.com/c/go/+/297229
Diffstat (limited to 'src/time/zoneinfo.go')
-rw-r--r--src/time/zoneinfo.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/time/zoneinfo.go b/src/time/zoneinfo.go
index c3662297c7..6db9443474 100644
--- a/src/time/zoneinfo.go
+++ b/src/time/zoneinfo.go
@@ -377,8 +377,10 @@ func tzsetOffset(s string) (offset int, rest string, ok bool) {
neg = true
}
+ // The tzdata code permits values up to 24 * 7 here,
+ // although POSIX does not.
var hours int
- hours, s, ok = tzsetNum(s, 0, 24)
+ hours, s, ok = tzsetNum(s, 0, 24*7)
if !ok {
return 0, "", false
}
@@ -487,7 +489,7 @@ func tzsetRule(s string) (rule, string, bool) {
}
offset, s, ok := tzsetOffset(s[1:])
- if !ok || offset < 0 {
+ if !ok {
return rule{}, "", false
}
r.time = offset