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).
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"
Fixesgolang#18836.
Change-Id: I99c96aa67dd5525cd239ea96452e6e8fcb25ce02
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
The text was updated successfully, but these errors were encountered: