pub unsafe extern "C" fn roaring64_bitmap_portable_deserialize_safe(
    buf: *const c_char,
    maxbytes: usize,
) -> *mut roaring64_bitmap_t
Expand description

Read a bitmap from a serialized buffer (reading up to maxbytes). In case of failure, NULL is returned.

This is meant to be compatible with other languages https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations

The function itself is safe in the sense that it will not cause buffer overflows: it will not read beyond the scope of the provided buffer (buf,maxbytes).

However, for correct operations, it is assumed that the bitmap read was once serialized from a valid bitmap (i.e., it follows the format specification). If you provided an incorrect input (garbage), then the bitmap read may not be in a valid state and following operations may not lead to sensible results. In particular, the serialized array containers need to be in sorted order, and the run containers should be in sorted non-overlapping order. This is is guaranteed to happen when serializing an existing bitmap, but not for random inputs.

You may use roaring64_bitmap_internal_validate to check the validity of the bitmap prior to using it.

We recommend that you use checksums to check that serialized data corresponds to a serialized bitmap.

This function is endian-sensitive. If you have a big-endian system (e.g., a mainframe IBM s390x), the data format is going to be big-endian and not compatible with little-endian systems.