Skip to content

fix: add bounds checks for transposition indices in flamegraph builder#6229

Merged
thorfour merged 1 commit intomainfrom
fix/flamegraph-empty-transposition-bounds-check
Mar 10, 2026
Merged

fix: add bounds checks for transposition indices in flamegraph builder#6229
thorfour merged 1 commit intomainfrom
fix/flamegraph-empty-transposition-bounds-check

Conversation

@thorfour
Copy link
Contributor

When a dictionary transposition has zero entries (empty dictionary), accessing .Value(oldIndex) panics with 'index out of range [0] with length 0'. The .IsNull() check does not protect against this because the null bitmap is nil (meaning all values are considered non-null), so it returns false even when the array is empty.

Add bounds checks (oldIndex >= indices.Len()) before accessing transposition indices in mergeSymbolizedRows and the key computation in generateFlamegraphArrowRecord. This matches the existing pattern already used in addSymbolizedRow which correctly guards with indices.Len() > 0.

@thorfour thorfour requested a review from a team as a code owner March 10, 2026 19:47
@alwaysmeticulous
Copy link

alwaysmeticulous bot commented Mar 10, 2026

✅ Meticulous spotted 0 visual differences across 378 screens tested: view results.

Meticulous evaluated ~4 hours of user flows against your PR.

Expected differences? Click here. Last updated for commit 5f623d1. This comment will update as new commits are pushed.

When a dictionary transposition has zero entries (empty dictionary), accessing
.Value(oldIndex) panics with 'index out of range [0] with length 0'. The
.IsNull() check does not protect against this because the null bitmap is nil
(meaning all values are considered non-null), so it returns false even when
the array is empty.

Add bounds checks (oldIndex >= indices.Len()) before accessing transposition
indices in mergeSymbolizedRows and the key computation in
generateFlamegraphArrowRecord. This matches the existing pattern already used
in addSymbolizedRow which correctly guards with indices.Len() > 0.
@thorfour thorfour force-pushed the fix/flamegraph-empty-transposition-bounds-check branch from af7b857 to 5f623d1 Compare March 10, 2026 20:01
@thorfour thorfour merged commit 29797d1 into main Mar 10, 2026
35 checks passed
@thorfour thorfour deleted the fix/flamegraph-empty-transposition-bounds-check branch March 10, 2026 20:35
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.

2 participants