-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
cmd/pprof: unescaped labels cause dot output to be malformed #53703
Comments
cc @golang/runtime |
Change https://go.dev/cl/416355 mentions this issue: |
Thanks for the report. This certainly needs to be fixed, but I think it should be fixed upstream in https://github.com/google/pprof (which we pull back into In https://github.com/google/pprof/blob/c488b8fa1db3fa467bf30beb5a1d6f4f10bb1b87/internal/graph/dotgraph.go#L250, I see escaping ( |
Ah, I wasn't aware that |
Sounds good, please open an issue on https://github.com/google/pprof. We pull the latest pprof every release, so a fix will be included for |
My PR google/pprof#689 should fix this bug. It is waiting on review (although there is an edge case related to non-printable characters that I would like to revisit). |
I've just hit the same issue, I was wondering if we could get any progress on this, and whether some help is needed. |
The google/pprof#689 that @evanj mentioned got stalled for the lack of attention, I think it was my turn. I'll comment there, but not sure if Evan is still willing to finish that work after this long of a context switch. |
I left some comments on that PR. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Label values don't seem to be escaped in the dot output, causing the result to be malformed. For example, given this test program: https://go.dev/play/p/duT2NS2iD7I
Running the program prints the profile base64-encoded to be demonstrable on the go playground. Using go tool pprof on the decoded profile shows the following (emphasis mine):
As you can see, the
label = "unescaped:some "string" with quotes"
does not parse because"string"
terminates the label string. The label should have beenlabel = "unescaped:some \"string\" with quotes"
instead.I confirmed that the correction works by running
sed 's/"string"/\"string\"/g'
on the generated profile.dot.See attached profile.zip for the profile file used in this session, as well as expected dot and expected resulting svg.
The text was updated successfully, but these errors were encountered: