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

html/template: an infinite recursion in Template.Execute() #53241

Closed
secsys-go opened this issue Jun 5, 2022 · 1 comment
Closed

html/template: an infinite recursion in Template.Execute() #53241

secsys-go opened this issue Jun 5, 2022 · 1 comment
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@secsys-go
Copy link

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?

Poc is here: poc.go

What did you expect to see?

It executes normally or just return an error.

What did you see instead?

It triggers an fatal error and shows that the program triggered an infinite recursion and caused stack overflow

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0201e0728 stack=[0xc0201e0000, 0xc0401e0000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x54b10e, 0x64c5c0})
        /home/zjx/.local/go/src/runtime/panic.go:1198 +0x71
runtime.newstack()
        /home/zjx/.local/go/src/runtime/stack.go:1088 +0x5ac
runtime.morestack()
        /home/zjx/.local/go/src/runtime/asm_amd64.s:461 +0x8b

goroutine 1 [running]:
reflect.Value.call({0x525fa0, 0x5554c0, 0x13}, {0x545e04, 0x4}, {0xc0013d9c38, 0x1, 0x1})
        /home/zjx/.local/go/src/reflect/value.go:359 +0x1b19 fp=0xc0201e0738 sp=0xc0201e0730 pc=0x486e59
reflect.Value.Call({0x525fa0, 0x5554c0, 0x0}, {0xc0013d9c38, 0x1, 0x1})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e07b0 sp=0xc0201e0738 pc=0x485105
text/template.safeCall({0x525fa0, 0x5554c0, 0x694800}, {0xc0013d9c38, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e0850 sp=0xc0201e07b0 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e0e20, {0x0, 0x0, 0x0}, {0x525fa0, 0x5554c0, 0x0}, {0x57e428, 0xc0000fee70}, {0x54eb8e, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e09a8 sp=0xc0201e0850 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e0e20, {0x0, 0x0, 0x0}, 0x0, {0x57e428, 0xc0000fee70}, {0xc000010400, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e0a90 sp=0xc0201e09a8 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e0e20, {0x0, 0x0, 0x0}, 0x5329e0, {0x524220, 0x694800, 0xc0201e0ce8})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e0b60 sp=0xc0201e0a90 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e0e20, {0x0, 0x0, 0xc0013cd860}, 0xc0000f22a0)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e0c50 sp=0xc0201e0b60 pc=0x4e81a5
text/template.(*state).walk(0xc0201e0e20, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe810})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e0cf0 sp=0xc0201e0c50 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e0e20, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e0d90 sp=0xc0201e0cf0 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5c60}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e0e80 sp=0xc0201e0d90 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5c60}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e0eb8 sp=0xc0201e0e80 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e0f10 sp=0xc0201e0eb8 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e1440)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e0f30 sp=0xc0201e0f10 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e0f70 sp=0xc0201e0f30 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e1560 sp=0xc0201e0f70 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e15d8 sp=0xc0201e1560 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e1678 sp=0xc0201e15d8 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e1c48, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e18e0}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e17d0 sp=0xc0201e1678 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e1c48, {0x0, 0x0, 0xc0013d6a60}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e18b8 sp=0xc0201e17d0 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e1c48, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e1988 sp=0xc0201e18b8 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e1c48, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e1a78 sp=0xc0201e1988 pc=0x4e81a5
text/template.(*state).walk(0xc0201e1c48, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e1b18 sp=0xc0201e1a78 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e1c48, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e1bb8 sp=0xc0201e1b18 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5c20}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e1ca8 sp=0xc0201e1bb8 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5c20}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e1ce0 sp=0xc0201e1ca8 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e1d38 sp=0xc0201e1ce0 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e2268)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e1d58 sp=0xc0201e1d38 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e1d98 sp=0xc0201e1d58 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e2388 sp=0xc0201e1d98 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e2400 sp=0xc0201e2388 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e24a0 sp=0xc0201e2400 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e2a70, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e2708}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e25f8 sp=0xc0201e24a0 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e2a70, {0x0, 0x0, 0xc0013d6a40}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e26e0 sp=0xc0201e25f8 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e2a70, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e27b0 sp=0xc0201e26e0 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e2a70, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e28a0 sp=0xc0201e27b0 pc=0x4e81a5
text/template.(*state).walk(0xc0201e2a70, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e2940 sp=0xc0201e28a0 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e2a70, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e29e0 sp=0xc0201e2940 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5be0}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e2ad0 sp=0xc0201e29e0 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5be0}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e2b08 sp=0xc0201e2ad0 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e2b60 sp=0xc0201e2b08 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e3090)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e2b80 sp=0xc0201e2b60 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e2bc0 sp=0xc0201e2b80 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e31b0 sp=0xc0201e2bc0 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e3228 sp=0xc0201e31b0 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e32c8 sp=0xc0201e3228 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e3898, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e3530}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e3420 sp=0xc0201e32c8 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e3898, {0x0, 0x0, 0xc0013d6a20}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e3508 sp=0xc0201e3420 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e3898, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e35d8 sp=0xc0201e3508 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e3898, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e36c8 sp=0xc0201e35d8 pc=0x4e81a5
text/template.(*state).walk(0xc0201e3898, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e3768 sp=0xc0201e36c8 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e3898, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e3808 sp=0xc0201e3768 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5ba0}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e38f8 sp=0xc0201e3808 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5ba0}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e3930 sp=0xc0201e38f8 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e3988 sp=0xc0201e3930 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e3eb8)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e39a8 sp=0xc0201e3988 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e39e8 sp=0xc0201e39a8 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e3fd8 sp=0xc0201e39e8 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e4050 sp=0xc0201e3fd8 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e40f0 sp=0xc0201e4050 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e46c0, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e4358}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e4248 sp=0xc0201e40f0 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e46c0, {0x0, 0x0, 0xc0013d6a00}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e4330 sp=0xc0201e4248 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e46c0, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e4400 sp=0xc0201e4330 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e46c0, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e44f0 sp=0xc0201e4400 pc=0x4e81a5
text/template.(*state).walk(0xc0201e46c0, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e4590 sp=0xc0201e44f0 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e46c0, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e4630 sp=0xc0201e4590 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5b60}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e4720 sp=0xc0201e4630 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5b60}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e4758 sp=0xc0201e4720 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e47b0 sp=0xc0201e4758 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e4ce0)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e47d0 sp=0xc0201e47b0 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e4810 sp=0xc0201e47d0 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e4e00 sp=0xc0201e4810 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e4e78 sp=0xc0201e4e00 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e4f18 sp=0xc0201e4e78 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e54e8, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e5180}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e5070 sp=0xc0201e4f18 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e54e8, {0x0, 0x0, 0xc0013d69e0}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e5158 sp=0xc0201e5070 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e54e8, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e5228 sp=0xc0201e5158 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e54e8, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e5318 sp=0xc0201e5228 pc=0x4e81a5
text/template.(*state).walk(0xc0201e54e8, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e53b8 sp=0xc0201e5318 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e54e8, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e5458 sp=0xc0201e53b8 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5b20}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e5548 sp=0xc0201e5458 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5b20}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e5580 sp=0xc0201e5548 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e55d8 sp=0xc0201e5580 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e5b08)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e55f8 sp=0xc0201e55d8 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e5638 sp=0xc0201e55f8 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e5c28 sp=0xc0201e5638 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e5ca0 sp=0xc0201e5c28 pc=0x485105
text/template.safeCall({0x525a60, 0xc0000102c0, 0x694800}, {0x693610, 0x5800c0, 0x528fa0})
        /home/zjx/.local/go/src/text/template/funcs.go:368 +0x9d fp=0xc0201e5d40 sp=0xc0201e5ca0 pc=0x4ef91d
text/template.(*state).evalCall(0xc0201e6310, {0x0, 0x0, 0x0}, {0x525a60, 0xc0000102c0, 0xc0201e5fa8}, {0x57e428, 0xc0000fe870}, {0x54f43f, ...}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:724 +0x81f fp=0xc0201e5e98 sp=0xc0201e5d40 pc=0x4eafff
text/template.(*state).evalFunction(0xc0201e6310, {0x0, 0x0, 0xc0013d69c0}, 0x4679fe, {0x57e428, 0xc0000fe870}, {0xc000010370, 0x1, 0x1}, ...)
        /home/zjx/.local/go/src/text/template/exec.go:579 +0x1ec fp=0xc0201e5f80 sp=0xc0201e5e98 pc=0x4e9bac
text/template.(*state).evalCommand(0xc0201e6310, {0x0, 0x0, 0x0}, 0x0, {0x52c5a0, 0x693610, 0x10})
        /home/zjx/.local/go/src/text/template/exec.go:466 +0xea fp=0xc0201e6050 sp=0xc0201e5f80 pc=0x4e862a
text/template.(*state).evalPipeline(0xc0201e6310, {0x0, 0x0, 0x524220}, 0xc0000f2300)
        /home/zjx/.local/go/src/text/template/exec.go:435 +0x145 fp=0xc0201e6140 sp=0xc0201e6050 pc=0x4e81a5
text/template.(*state).walk(0xc0201e6310, {0x0, 0x0, 0x10000000040c9d4}, {0x57e308, 0xc0000fe8d0})
        /home/zjx/.local/go/src/text/template/exec.go:254 +0x1f6 fp=0xc0201e61e0 sp=0xc0201e6140 pc=0x4e6bb6
text/template.(*state).walk(0xc0201e6310, {0x0, 0x0, 0x52b9a0}, {0x57e5d8, 0xc0000fe7b0})
        /home/zjx/.local/go/src/text/template/exec.go:263 +0x37d fp=0xc0201e6280 sp=0xc0201e61e0 pc=0x4e6d3d
text/template.(*Template).execute(0xc000194100, {0x57ab20, 0xc0013d5ae0}, {0x0, 0x0})
        /home/zjx/.local/go/src/text/template/exec.go:217 +0x2d8 fp=0xc0201e6370 sp=0xc0201e6280 pc=0x4e68b8
text/template.(*Template).Execute(...)
        /home/zjx/.local/go/src/text/template/exec.go:200
html/template.(*Template).ExecuteTemplate(0x0, {0x57ab20, 0xc0013d5ae0}, {0x549df5, 0x0}, {0x0, 0x0})
        /home/zjx/.local/go/src/html/template/template.go:139 +0x6a fp=0xc0201e63a8 sp=0xc0201e6370 pc=0x51018a
main.main.func1()
        /home/iscsi/goarea/go-fdg-exmaples/std/html/template/PocRecursiveExec/poc.go:13 +0x65 fp=0xc0201e6400 sp=0xc0201e63a8 pc=0x516245
runtime.call16(0xc0000febd0, 0xc0000102c0, 0x0, 0x0, 0x0, 0x0, 0xc0201e6930)
        /home/zjx/.local/go/src/runtime/asm_amd64.s:625 +0x49 fp=0xc0201e6420 sp=0xc0201e6400 pc=0x45d129
runtime.reflectcall(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        <autogenerated>:1 +0x3c fp=0xc0201e6460 sp=0xc0201e6420 pc=0x4612dc
reflect.Value.call({0x525a60, 0xc0000102c0, 0x4efbab}, {0x545e04, 0x4}, {0x693610, 0x0, 0x5800c0})
        /home/zjx/.local/go/src/reflect/value.go:556 +0x845 fp=0xc0201e6a50 sp=0xc0201e6460 pc=0x485b85
reflect.Value.Call({0x525a60, 0xc0000102c0, 0x0}, {0x693610, 0x0, 0x0})
        /home/zjx/.local/go/src/reflect/value.go:339 +0xc5 fp=0xc0201e6ac8 sp=0xc0201e6a50 pc=0x485105
exit status 2
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 5, 2022
@seankhliao
Copy link
Member

This is infinite recursion in user code, I don't think there's anything to do here.
text/template tracks execution depth for template invocations, but passing it through strings disassociates them. #15618

@golang golang locked and limited conversation to collaborators Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants