Skip to content

fix: avoid u32 overflow in statistics for full bitmaps#358

Open
SAY-5 wants to merge 1 commit into
RoaringBitmap:mainfrom
SAY-5:fix-statistics-overflow
Open

fix: avoid u32 overflow in statistics for full bitmaps#358
SAY-5 wants to merge 1 commit into
RoaringBitmap:mainfrom
SAY-5:fix-statistics-overflow

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 18, 2026

Copy link
Copy Markdown

The n_values_array_containers and n_values_run_containers fields in Statistics are u32, but a bitmap can hold up to 2^32 values across its containers, so statistics() overflows for a full bitmap (panics with overflow checks on, wraps without). This widens both fields to u64 to match n_values_bitset_containers and cardinality, and drops the as u32 casts. Closes #357.

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.

roaring::RoaringBitmap::full().statistics() panics if overflow checks are enabled

1 participant