The previous CL is the real fix. This one is just insurance.
Fixes #14046 again.
Change-Id: I553349504bb1789e4b66c888dbe4034568918ad6
Reviewed-on: https://go-review.googlesource.com/18977
Reviewed-by: Austin Clements <austin@google.com>
// Save other goroutines.
for _, gp1 := range allgs {
if isOK(gp1) {
+ if len(r) == 0 {
+ // Should be impossible, but better to return a
+ // truncated profile than to crash the entire process.
+ break
+ }
saveg(^uintptr(0), ^uintptr(0), gp1, &r[0])
r = r[1:]
}