Skip to content

tendermint: ensure ValidatorIndex is ≤ i32::MAX#1411

Merged
romac merged 1 commit intocometbft:mainfrom
mina86:b
Apr 17, 2024
Merged

tendermint: ensure ValidatorIndex is ≤ i32::MAX#1411
romac merged 1 commit intocometbft:mainfrom
mina86:b

Conversation

@mina86
Copy link
Copy Markdown
Contributor

@mina86 mina86 commented Apr 17, 2024

During conversion from usize to ValidatorIndex first convert the value to i32 to make sure that the value is ≤ i32::MAX. Without that intermediate conversion, u32::MAX as usize is successfully converted into the index.

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Added entry in .changelog/

During conversion from usize to ValidatorIndex first convert the value
to `i32` to make sure that the value is ≤ i32::MAX.  Without that
intermediate conversion, `u32::MAX as usize` is successfully converted
into the index.
@romac romac merged commit 6399b5b into cometbft:main Apr 17, 2024
@mina86 mina86 deleted the b branch April 17, 2024 13:00
mina86 added a commit to mina86/tendermint-rs that referenced this pull request Apr 18, 2024
During conversion from usize to ValidatorIndex first convert the value
to `i32` to make sure that the value is ≤ i32::MAX.  Without that
intermediate conversion, `u32::MAX as usize` is successfully converted
into the index.
melekes added a commit to cometbft/cometbft-rs that referenced this pull request Apr 25, 2025
melekes added a commit to cometbft/cometbft-rs that referenced this pull request May 14, 2025
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