mirror of
https://github.com/golang/go
synced 2024-11-22 18:54:44 -07:00
da7ac77380
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>
26 lines
459 B
Go
26 lines
459 B
Go
// errorcheck
|
|
|
|
// Copyright 2023 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//go:build !386 && !amd64p32 && !arm && !mips && !mipsle
|
|
|
|
package main
|
|
|
|
func g() { // GC_ERROR "stack frame too large"
|
|
xs := [3000 * 2000][33]int{}
|
|
for _, x := range xs {
|
|
if len(x) > 50 {
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
func main() { // GC_ERROR "stack frame too large"
|
|
defer f()
|
|
g()
|
|
}
|
|
|
|
func f() {}
|