-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed as not planned
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Description
What version of Go are you using (go version)?
$ go version go version go1.17.8 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="auto" GOARCH="amd64" GOBIN="/home/zjx/workspace/gowork/bin" GOCACHE="/home/zjx/.cache/go-build" GOENV="/home/zjx/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/zjx/workspace/gowork/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/zjx/workspace/gowork" GOPRIVATE="" GOPROXY="https://goproxy.cn,direct" GOROOT="/home/zjx/.local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/home/zjx/.local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.17.8" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/zjx/workspace/gowork/src/go-fdg-exmaples/std/go.mod" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1878510231=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I created an illegal text to parse as template.
A link on go.dev is : Poc.go
What did you expect to see?
It parses failed and return (nil, error)
What did you see instead?
It trigger a slice out of range fatal error, like:
panic: runtime error: slice bounds out of range [:12] with length 11
goroutine 6 [running]:
text/template/parse.(*lexer).emit(...)
/usr/local/go-faketime/src/text/template/parse/lex.go:163
text/template/parse.lexRightDelim(0xc000108000)
/usr/local/go-faketime/src/text/template/parse/lex.go:354 +0x29a
text/template/parse.(*lexer).run(0xc000108000)
/usr/local/go-faketime/src/text/template/parse/lex.go:236 +0x2a
created by text/template/parse.lex
/usr/local/go-faketime/src/text/template/parse/lex.go:229 +0x1ca
Program exited.Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.