Skip to content

tickettreap: Fix off-by-one in getByIndex - #3763

Open
jholdstock wants to merge 1 commit into
decred:masterfrom
jholdstock:treappanic
Open

tickettreap: Fix off-by-one in getByIndex#3763
jholdstock wants to merge 1 commit into
decred:masterfrom
jholdstock:treappanic

Conversation

@jholdstock

@jholdstock jholdstock commented Aug 16, 2026

Copy link
Copy Markdown
Member

This fixes an off-by-one bug in the validation of the getByIndex idx param. This was not caught by tests because the test was only checking that a panic was raised and not where the panic originated. This check was satisfied by a stdlib panic rather than the intended panic from dcrd code.

Comment thread blockchain/stake/internal/tickettreap/common.go Outdated
@jholdstock jholdstock changed the title tickettreap: Couple of bug fixes in getByIndex bounds checking tickettreap: Fix off-by-one in getByIndex Aug 16, 2026
This fixes an off-by-one bug in the validation of the getByIndex idx
param. This was not caught by tests because the test was only checking
that a panic was raised and not where the panic originated. This check
was satisfied by a stdlib panic rather than the intended panic from dcrd
code.
@davecgh davecgh added this to the 2.2.0 milestone Aug 16, 2026
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