Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: panic in LoadLocationFromTZData with malformed data #29437

Closed
josharian opened this issue Dec 28, 2018 · 1 comment
Closed

time: panic in LoadLocationFromTZData with malformed data #29437

josharian opened this issue Dec 28, 2018 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@josharian
Copy link
Contributor

package main

import "time"

func main() {
	tzdata := "TZif\x00000000000000000\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0000"
	time.LoadLocationFromTZData("abc", []byte(tzdata))
}

Tip:

panic: runtime error: index out of range

goroutine 1 [running]:
time.LoadLocationFromTZData(0x1074f08, 0x3, 0xc00007c030, 0x2e, 0x30, 0x30, 0xc000072058, 0x0)
	/Users/josh/go/tip/src/time/zoneinfo_read.go:226 +0xf09
main.main()
	/Users/josh/go/tip/src/x.go:7 +0x77
exit status 2

Playground: https://play.golang.com/p/1nF0x-TpNaL

Found with go-fuzz.

cc @dvyukov

@josharian josharian added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. NeedsFix The path to resolution is known, but the work has not been done. help wanted and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 28, 2018
@gopherbot
Copy link

Change https://golang.org/cl/155746 mentions this issue: time: reject tzdata with no zones

@josharian josharian added this to the Go1.13 milestone Dec 28, 2018
josharian added a commit to josharian/go that referenced this issue Dec 30, 2018
Fixes golang#29437

Change-Id: Ice0a03a543e564d66651bfdfce5cd32ebaa35926
@golang golang locked and limited conversation to collaborators Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants