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

runtime/pprof: printStackRecord should check whether len(stk) == 0 #18836

Closed
josharian opened this issue Jan 29, 2017 · 1 comment
Closed

runtime/pprof: printStackRecord should check whether len(stk) == 0 #18836

josharian opened this issue Jan 29, 2017 · 1 comment

Comments

@josharian
Copy link
Contributor

josharian commented Jan 29, 2017

In runtime/pprof/pprof.go, func printStackRecord, if len(stk) == 0, I think junk will be written to the profile. This could happen if a user calls Add on a custom profile with a skip value that is too large. See also #18788 (comment).

cc @matloob

@josharian josharian added this to the Go1.9Maybe milestone Jan 29, 2017
@gopherbot
Copy link

CL https://golang.org/cl/36891 mentions this issue.

josharian added a commit to josharian/go that referenced this issue Feb 14, 2017
If the caller passes a large number to Profile.Add,
the list of pcs is empty, which results in junk
(a nil pc) being recorded. Check for that explicitly.

Without the fix, the test added in this CL fails with:

got:
	"test18836 profile: total 1\n1 @\n#\t0x0\n\n"
want:
	"test 18836 profile: total 0"

Fixes golang#18836.

Change-Id: I99c96aa67dd5525cd239ea96452e6e8fcb25ce02
@golang golang locked and limited conversation to collaborators Feb 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants