]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix funcdata encode for functions with large frame size
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 13 Oct 2023 03:32:57 +0000 (10:32 +0700)
committerGopher Robot <gobot@golang.org>
Wed, 18 Oct 2023 16:32:07 +0000 (16:32 +0000)
commitda7ac77380f68ed855ab4565c4ef2217249c53c2
treeb4fad76b635470e607faf9a1b68d73ba0a798731
parent80834af2063962bad87a56f0f45546cc18f30a9c
cmd/compile: fix funcdata encode for functions with large frame size

The funcdata is encoded as varint, with the upper limit set to 1e9.
However, the stack offsets could be up to 1<<30. Thus emitOpenDeferInfo
will trigger an ICE for function with large frame size.

By using binary.PutUvarint, the frame offset could be encoded correctly
for value larger than 1<<35, allow the compiler to report the error.

Further, the runtime also do validation when reading in the funcdata
value, so a bad offset won't likely cause mis-behavior.

Fixes #52697

Change-Id: I084c243c5d24c5d31cc22d5b439f0889e42b107c
Reviewed-on: https://go-review.googlesource.com/c/go/+/535077
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/ssagen/ssa.go
src/cmd/compile/internal/types2/stdlib_test.go
src/go/types/stdlib_test.go
test/fixedbugs/issue52697.go [new file with mode: 0644]