Skip to content

PRW2: Fix index out-of-range panic#7299

Open
SungJin1212 wants to merge 2 commits intocortexproject:masterfrom
SungJin1212:Fix-out-of-range-in-PRW2-handler
Open

PRW2: Fix index out-of-range panic#7299
SungJin1212 wants to merge 2 commits intocortexproject:masterfrom
SungJin1212:Fix-out-of-range-in-PRW2-handler

Conversation

@SungJin1212
Copy link
Member

When a reused TimeSeriesV2 object contains leftover metadata values (e.g., UnitRef: 99) from a previous large request, and the new incoming request omits metadata, Unmarshal skips overwriting those fields. If the new request has a smaller Symbols table, accessing req.Symbols[v2Ts.Metadata.UnitRef] causes an immediate index out of range panic.

This PR resets metadata before returning to the sync.Pool. The test verifies that subsequent requests with omitted metadata do not cause a panic.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
@SungJin1212 SungJin1212 changed the title PRW2: Fix index out-of-range panic in PRW2 handler PRW2: Fix index out-of-range panic Feb 26, 2026
@dosubot dosubot bot added the type/bug label Feb 26, 2026
Signed-off-by: SungJin1212 <tjdwls1201@gmail.com>
Copy link
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 26, 2026
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size/M type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants