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

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Dec 28, 2018

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

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 28, 2018

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

@josharian josharian removed the help wanted label Dec 28, 2018
@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
@gopherbot gopherbot closed this in 58bf401 Feb 27, 2019
@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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.