]> Untitled Git - bdk/commit
fix(chain): prevent integer overflow in `SpkIterator::new_with_range`
authorElias Rohrer <dev@tnull.de>
Wed, 8 Apr 2026 09:42:39 +0000 (11:42 +0200)
committer志宇 <hello@evanlinjin.me>
Thu, 23 Apr 2026 15:35:37 +0000 (15:35 +0000)
commitb340e96f0221f6c3088fe5daf2b87c56b3bf4010
treec291ea28081fdc069d0b3b27679df7b1bf7ec65f
parent86420a2bb3ac4ae26f4af013331409253479bb65
fix(chain): prevent integer overflow in `SpkIterator::new_with_range`

The start and end bound calculations used unchecked addition which
overflows when given `u32::MAX`, causing the iterator to silently produce
wrong results (e.g., an empty iterator for `0..=u32::MAX` in release
mode). Use `saturating_add` to handle the boundary correctly.

Co-Authored-By: HAL 9000
Signed-off-by: Elias Rohrer <dev@tnull.de>
crates/chain/src/spk_iter.rs