Skip to content

Expose internal_validate() on the C++ Roaring and Roaring64Map wrappers - #890

Merged
lemire merged 1 commit into
RoaringBitmap:masterfrom
ahmadov:ahmadov/expose-cpp-internal-validate
Sep 24, 2026
Merged

lemire merged 1 commit into
RoaringBitmap:masterfrom
ahmadov:ahmadov/expose-cpp-internal-validate

Conversation

@ahmadov

@ahmadov ahmadov commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

readSafe() only guarantees the input buffer is not read out of bounds, it still accepts structurally invalid containers.

For example, a run container declaring n_runs == 0 deserializes into a container with a NULL runs pointer: readSafe() succeeds, but the first set operation dereferences that NULL pointer and crashes.

The C API exposes roaring_bitmap_internal_validate for untrusted input, but the C++ wrappers did not surface it, and Roaring64Map's inner bitmaps are private, so callers could not validate them without re-parsing.

readSafe() does not validate container structure, and the C++ wrappers did
not surface roaring_bitmap_internal_validate. Expose it on both.
@lemire

lemire commented Sep 23, 2026

Copy link
Copy Markdown
Member

Running tests.

@lemire
lemire merged commit ca57d26 into RoaringBitmap:master Sep 24, 2026
21 checks passed
@ahmadov ahmadov mentioned this pull request Sep 24, 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