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

improve: fix unsafeStrToSlice panic due to empty string #772

Merged
merged 1 commit into from Feb 3, 2022

Conversation

linthan
Copy link
Contributor

@linthan linthan commented Jan 28, 2022

due to empty string, the unsafeStrToSlice will result in the panic of the pyroscope server.

@codecov
Copy link

codecov bot commented Jan 28, 2022

Codecov Report

Merging #772 (dc44444) into main (04733c8) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #772   +/-   ##
=======================================
  Coverage   73.03%   73.03%           
=======================================
  Files          65       65           
  Lines        2291     2291           
  Branches      493      493           
=======================================
  Hits         1673     1673           
  Misses        579      579           
  Partials       39       39           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 04733c8...dc44444. Read the comment docs.

abeaumont added a commit that referenced this pull request Jan 28, 2022
This is a different approach to PR #772. Instead of filtering out
empty strings in one of the possible insertion paths, we handle it
properly to prevent problems both from this or other insertion paths:
- We remove the unsafe string to bytes conversion, using instead the
insertion functions that handle strings.
- We handle the corner case of empty strings properly to prevent an
infinite loop.
@abeaumont
Copy link
Contributor

Thanks for reporting and fixing the issue @linthan. I believe it may be better to remove unsafeStroToSlice completely and to have better support for empty strings. Take a look to #773

Copy link
Collaborator

@kolesnikovae kolesnikovae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing the issue @linthan!

I’m wondering if this is a hypothetic case or we do have traces with empty function/frame names. That would mean we should make sure such a profile is handled correctly along the whole workflow (ingest/query).

@kolesnikovae kolesnikovae added backend Mostly go code bug Something isn't working labels Jan 28, 2022
@petethepig petethepig merged commit 189f775 into grafana:main Feb 3, 2022
korniltsev pushed a commit that referenced this pull request Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Mostly go code bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants