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 initLocal on js/wasm #28649

Closed
FiloSottile opened this issue Nov 8, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@FiloSottile
Copy link
Member

commented Nov 8, 2018

This very simple program panics when executed with misc/wasm/go_js_wasm_exec.

package main

import (
	"log"
)

func main() {
	log.Print("Test.")
}
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
time.itoa(...)
	/Users/valsorda/go/src/time/zoneinfo_js.go:51
time.initLocal()
	/Users/valsorda/go/src/time/zoneinfo_js.go:39 +0x3b
sync.(*Once).Do(0x15a3c0, 0x39a18)
	/Users/valsorda/go/src/sync/once.go:44 +0xf
time.(*Location).get(0x141120, 0x8)
	/Users/valsorda/go/src/time/zoneinfo.go:79 +0x5
time.Time.abs(0xbef100f060a9d100, 0x112701, 0x141120, 0x5)
	/Users/valsorda/go/src/time/time.go:455 +0x4
time.Time.date(0xbef100f060a9d100, 0x112701, 0x141120, 0x16a50001, 0xc056000, 0x32e59, 0x5, 0x100000076)
	/Users/valsorda/go/src/time/time.go:964 +0x2
time.Time.Date(0xbef100f060a9d100, 0x112701, 0x141120, 0x0, 0xc04c000, 0xc000180)
	/Users/valsorda/go/src/time/time.go:495 +0x2
log.(*Logger).formatHeader(0xc04a000, 0xc04a030, 0xbef100f060a9d100, 0x112701, 0x141120, 0x0, 0x0, 0x0)
	/Users/valsorda/go/src/log/log.go:103 +0x5b
log.(*Logger).Output(0xc04a000, 0x2, 0xc0140c8, 0x5, 0x0, 0x0)
	/Users/valsorda/go/src/log/log.go:167 +0x9
log.Print(0xc030788, 0x1, 0x1)
	/Users/valsorda/go/src/log/log.go:296 +0x3
main.main()
	/Users/valsorda/go/src/jspanic.go:8 +0x2
exit status 2
@FiloSottile

This comment has been minimized.

Copy link
Member Author

commented Nov 8, 2018

/cc @neelance

@agnivade

This comment has been minimized.

Copy link
Member

commented Nov 8, 2018

My bad, I did not think of negative offsets. Sigh .. Sending a fix.

@gopherbot

This comment has been minimized.

Copy link

commented Nov 8, 2018

Change https://golang.org/cl/148338 mentions this issue: time: handle negative offsets on js/wasm

@gopherbot gopherbot closed this in 5e9ad4a Nov 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.