Skip to content

Fix integer overflow in IntervalStore iterator - #404

Merged
Dr-Emann merged 1 commit into
RoaringBitmap:mainfrom
Liblor:next-many-int-overflow
Nov 17, 2026
Merged

Dr-Emann merged 1 commit into
RoaringBitmap:mainfrom
Liblor:next-many-int-overflow

Conversation

@Liblor

@Liblor Liblor commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

In interval_store.rs, evaluating (end - start + 1) causes a u16 integer overflow when an interval spans the entire container [0, 65535]. Converting (end - start) to usize before adding 1 prevents the overflow.

Fixes #403


  • cargo fmt -- --check ✅
  • cargo clippy --all-targets -- -D warnings ✅
  • cargo test ✅

Hi,

will there be a minor release for this fix, or on what date would you release a fix?

In interval_store.rs, evaluating `(end - start + 1)` causes a `u16`
integer overflow when an interval spans the entire container [0, 65535].
Converting `(end - start)` to usize before adding 1 prevents the
overflow.

Fixes RoaringBitmap#403
@Dr-Emann
Dr-Emann requested a review from Kerollmops November 12, 2026 01:26
@Dr-Emann
Dr-Emann added this pull request to the merge queue Nov 17, 2026
Merged via the queue into RoaringBitmap:main with commit fe8ac70 Nov 17, 2026
14 checks passed
@Kerollmops

Copy link
Copy Markdown
Member

Thanks for the fix @Liblor and for the review and merge @Dr-Emann. Sorry for the late response.

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.

Integer overflow in RunIter<I>::next_many

3 participants