Skip to content

bucket: add count guard for branch pages in Stats (backport 1.3)#1173

Merged
ahrtr merged 1 commit intoetcd-io:release-1.3from
quocvibui:fix-stats-branch-page-oob-1.3
Mar 31, 2026
Merged

bucket: add count guard for branch pages in Stats (backport 1.3)#1173
ahrtr merged 1 commit intoetcd-io:release-1.3from
quocvibui:fix-stats-branch-page-oob-1.3

Conversation

@quocvibui
Copy link
Copy Markdown
Contributor

Backport of #1171 to release-1.3.

Bucket.Stats() panics with an index-out-of-range error when iterating branch pages with a zero element count. Wraps the branch element access in the same p.count != 0 guard used for leaf pages.

Fixes #1170

Signed-off-by: Quoc Bui buiviquoc@gmail.com

Bucket.Stats() panics with index-out-of-range when iterating branch
pages with zero elements. The leaf page path has a count != 0 guard,
but the branch page path accesses branchPageElement(count - 1)
without one. Wrap the branch element access in the same guard.

Fixes etcd-io#1170

Signed-off-by: Quoc Bui <buiviquoc@gmail.com>
quocvibui added a commit to quocvibui/bbolt that referenced this pull request Mar 30, 2026
Add changelog entries for the backported fix to 1.4 (etcd-io#1172) and
1.3 (etcd-io#1173).

Signed-off-by: Quoc Bui <buiviquoc@gmail.com>
@ahrtr
Copy link
Copy Markdown
Member

ahrtr commented Mar 30, 2026

/ok-to-test

@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ahrtr, quocvibui

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ahrtr ahrtr merged commit 16271e4 into etcd-io:release-1.3 Mar 31, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants