Skip to content

time: panic in LoadLocationFromTZData with malformed data #29437

@josharian

Description

@josharian
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions