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

baggage.New panics on members with values including 0x80 char #5495

Closed
fabiobozzo opened this issue Jun 6, 2024 · 1 comment
Closed

baggage.New panics on members with values including 0x80 char #5495

fabiobozzo opened this issue Jun 6, 2024 · 1 comment
Labels
area:baggage Part of OpenTelemetry baggage bug Something isn't working
Milestone

Comments

@fabiobozzo
Copy link
Contributor

Description

The validation rule for baggage key/values chars has a N+1 problem with the unicode value: 0x80.
For instance, baggage.NewMemberRaw could be called with a string value including the rune 128 and return no error, but panic.

=== RUN TestValidateValueChar
--- FAIL: TestValidateValueChar (0.00s)
panic: runtime error: index out of range [128] with length 128 [recovered]
panic: runtime error: index out of range [128] with length 128

Solution in: #5494 👈

Environment

  • OS: any
  • Architecture: any
  • Go Version: 1.21+
  • opentelemetry-go version: [v1.26.0, 59bbe11]

Steps To Reproduce

  1. Call baggage.NewMemberRaw with a string (value, or key) including the 0x80 rune.
  2. The new member is returned with no errors.
  3. Call baggage.New with that member
  4. validateValueChar in the downstream call stack panics because of an unsafe slice boundary check

Expected behavior

The creation of a baggage member having strings including the 0x80 char fails with an error, instead of panicking.

@fabiobozzo fabiobozzo added the bug Something isn't working label Jun 6, 2024
@MrAlias MrAlias added this to the v1.28.0 milestone Jun 6, 2024
@MrAlias MrAlias added the area:baggage Part of OpenTelemetry baggage label Jun 6, 2024
@MrAlias
Copy link
Contributor

MrAlias commented Jun 20, 2024

Closed by #5494

@MrAlias MrAlias closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:baggage Part of OpenTelemetry baggage bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants