Skip to content

[pdata/pprofile] add bounds checks to FromAttributeIndices - #15517

Merged
mx-psi merged 4 commits into
open-telemetry:mainfrom
florianl:pprofiles-fixes-2
Jul 2, 2026
Merged

mx-psi merged 4 commits into
open-telemetry:mainfrom
florianl:pprofiles-fixes-2

Conversation

@florianl

@florianl florianl commented Jun 30, 2026 •

Copy link
Copy Markdown
Member

Description

FromAttributeIndices passed AttributeIndices values directly to table.At() and StringTable.At() without validating them first. An out-of-range or negative index causes a panic, crashing the collector process.

Fix this by checking each index against the respective table length before access and returning a descriptive error instead.

Note

As this is a breaking change, the respective change for OTel collector contrib is open-telemetry/opentelemetry-collector-contrib#49373.

Link to tracking issue

Fixes #

Testing

Documentation

Authorship

  • I, a human, wrote this pull request description myself.

@florianl
florianl requested review from a team, dmathieu and mx-psi as code owners June 30, 2026 08:31
@github-actions
github-actions Bot requested review from bogdandrutu and dmitryax June 30, 2026 08:31
FromAttributeIndices passed AttributeIndices values directly to
table.At() and StringTable.At() without validating them first. An
out-of-range or negative index causes a panic, crashing the
collector process.

Fix this by checking each index against the respective table length
before access and returning a descriptive error instead.

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
@florianl
florianl force-pushed the pprofiles-fixes-2 branch from 6e8f0e2 to ad13889 Compare June 30, 2026 08:31
@codspeed

This comment was marked as low quality.

@codecov

codecov Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.09%. Comparing base (a23b4aa) to head (e47f30b).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15517   +/-   ##
=======================================
  Coverage   91.09%   91.09%           
=======================================
  Files         726      726           
  Lines       48031    48037    +6     
=======================================
+ Hits        43752    43758    +6     
  Misses       2981     2981           
  Partials     1298     1298           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
Comment thread .chloggen/pprofiles-fixes-2.yaml Resolved
florianl pushed a commit to florianl/opentelemetry-collector-contrib that referenced this pull request Jun 30, 2026
open-telemetry/opentelemetry-collector#15517 is a breaking change to prevent a panic. Handle this change for OTel collector contrib.

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
Comment thread pdata/pprofile/attributes.go Resolved
@florianl

florianl commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

/rerun

@mx-psi mx-psi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@florianl ping me on Slack when you are ready to merge this so we can trigger a update-otel PR on contrib and minimize disruption on contrib tests

@mx-psi
mx-psi added this pull request to the merge queue Jul 2, 2026
Merged via the queue into open-telemetry:main with commit 193fe1b Jul 2, 2026
63 of 69 checks passed
mx-psi pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Jul 2, 2026
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

open-telemetry/opentelemetry-collector#15517 is
a breaking change to prevent a panic. Handle this change for OTel
collector contrib.

<!-- Issue number (e.g. #1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes

<!--Describe what testing was performed and which tests were added.-->
#### Testing

<!--Describe the documentation added.-->
#### Documentation

<!--Authorship attestation. See AGENTS.md for details. AI agents must
not check this box on behalf
of the user; the human author must check it themselves before the PR is
ready for review.-->
#### Authorship

- [x] I, a human, wrote this pull request description myself.

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
lazureykis added a commit to lazureykis/opentelemetry-collector that referenced this pull request Jul 6, 2026
- FromAttributeIndices now returns (pcommon.Map, error) after open-telemetry#15517; update
  the assertSampleDictAttr test helper to check the error.
- setString now returns errTooManyStringTableEntries, matching the sentinel
  fix in open-telemetry#15511; drop the stale "preserve parity" workaround.

Assisted-by: Claude Opus 4.8
lazureykis added a commit to lazureykis/opentelemetry-collector that referenced this pull request Aug 1, 2026
…ictionary

Follow-up to open-telemetry#15517, which added bounds checks to FromAttributeIndices.
The same untrusted-input crash survived in two sibling paths:

  - FromLocationIndices had no bounds check at all, so an out-of-range
    or negative Stack.LocationIndices value panicked.
  - The switchDictionary loops checked only the upper bound, letting a
    negative index reach At(-1).

FromLocationIndices now returns an error, mirroring FromAttributeIndices.
It has no production callers in core or contrib, so the signature change
is contained to this package's own tests.

Fixes open-telemetry#15697

Assisted-by: Claude Opus 5
lazureykis added a commit to lazureykis/opentelemetry-collector that referenced this pull request Aug 1, 2026
…ictionary

Follow-up to open-telemetry#15517, which added bounds checks to FromAttributeIndices.
The same untrusted-input crash survived in two sibling paths:

  - FromLocationIndices had no bounds check at all, so an out-of-range
    or negative Stack.LocationIndices value panicked.
  - The switchDictionary loops checked only the upper bound, letting a
    negative index reach At(-1).

FromLocationIndices now returns an error, mirroring FromAttributeIndices.
It has no production callers in core or contrib, so the signature change
is contained to this package's own tests.

Fixes open-telemetry#15697

Assisted-by: Claude Opus 5
lazureykis added a commit to lazureykis/opentelemetry-collector that referenced this pull request Aug 2, 2026
…ictionary

Follow-up to open-telemetry#15517, which added bounds checks to FromAttributeIndices.
The same untrusted-input crash survived in two sibling paths:

  - FromLocationIndices had no bounds check at all, so an out-of-range
    or negative Stack.LocationIndices value panicked.
  - The switchDictionary loops checked only the upper bound, letting a
    negative index reach At(-1).

FromLocationIndices now returns an error, mirroring FromAttributeIndices.
It has no production callers in core or contrib, so the signature change
is contained to this package's own tests.

Fixes open-telemetry#15697

Assisted-by: Claude Opus 5
AsherBond pushed a commit to AsherBond/opentelemetry-collector that referenced this pull request Aug 25, 2026
…ictionary (open-telemetry#15698)

#### Description

Follow-up to open-telemetry#15517, which added bounds checks to
`FromAttributeIndices`. The same untrusted-input crash survived in two
sibling paths: `FromLocationIndices` had no bounds check at all, and the
five `switchDictionary` loops checked only the upper bound, letting a
negative index reach `At(-1)`.

`FromLocationIndices` gains an error return, mirroring what open-telemetry#15517 did
to `FromAttributeIndices`, including the message shape. It has no
production callers in core or contrib, so the signature change is
contained to this package's own tests.

#### Link to tracking issue

Fixes open-telemetry#15697

#### Testing

Added out-of-bounds and negative cases to `TestFromLocationIndices`, and
a negative-index case to each of the five `switchDictionary` tests. Each
new case panics without the corresponding guard. `go test -race` passes
for `pdata/pprofile` and the whole `pdata` module.

#### Documentation

Changelog entry (`change_type: breaking`, `component: pkg/pprofile`,
`change_logs: [user, api]`).
#### Authorship

- [x] I, a human, wrote this pull request description myself.

---------

Co-authored-by: Alex Boten <223565+codeboten@users.noreply.github.com>
lazureykis added a commit to lazureykis/opentelemetry-collector that referenced this pull request Sep 17, 2026
- FromAttributeIndices now returns (pcommon.Map, error) after open-telemetry#15517; update
  the assertSampleDictAttr test helper to check the error.
- setString now returns errTooManyStringTableEntries, matching the sentinel
  fix in open-telemetry#15511; drop the stale "preserve parity" workaround.

Assisted-by: Claude Opus 4.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants