Skip to content

Commit

Permalink
chore: update bindings to CRoaring 4.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Sep 20, 2024
1 parent d85ca25 commit 667e730
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Current documentation is available at https://docs.rs/croaring/latest/croaring/

## CRoaring Version

This crate uses [CRoaring version `4.1.4`](https://github.com/RoaringBitmap/CRoaring/releases/tag/v4.1.4).
This crate uses [CRoaring version `4.1.6`](https://github.com/RoaringBitmap/CRoaring/releases/tag/v4.1.6).
The version of this crate does not necessarily match the version of CRoaring: the major version of the crate is only
incremented when there are breaking changes in the Rust API: It is possible (and has happened) that breaking changes
in the CRoaring C API do not necessitate a major version bump in this crate.
4 changes: 2 additions & 2 deletions croaring-sys/CRoaring/bindgen_bundled_version.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* automatically generated by rust-bindgen 0.70.1 */

pub const ROARING_VERSION: &[u8; 6] = b"4.1.4\0";
pub const ROARING_VERSION: &[u8; 6] = b"4.1.6\0";
pub const ROARING_VERSION_MAJOR: _bindgen_ty_1 = 4;
pub const ROARING_VERSION_MINOR: _bindgen_ty_1 = 1;
pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 4;
pub const ROARING_VERSION_REVISION: _bindgen_ty_1 = 6;
pub type _bindgen_ty_1 = ::core::ffi::c_uint;
extern "C" {
#[doc = " result might be undefined when input_num is zero"]
Expand Down
25 changes: 23 additions & 2 deletions croaring-sys/CRoaring/roaring.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-09-19T15:00:26Z
// Created by amalgamation.sh on 2024-09-20T14:21:41Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down Expand Up @@ -24641,10 +24641,13 @@ roaring64_bitmap_t *roaring64_bitmap_portable_deserialize_safe(
memcpy(&high32, buf, sizeof(high32));
buf += sizeof(high32);
read_bytes += sizeof(high32);
if (high32 < previous_high32) {
// High 32 bits must be strictly increasing.
if (high32 <= previous_high32) {
roaring64_bitmap_free(r);
return NULL;
}
previous_high32 = high32;

// Read the 32-bit Roaring bitmaps representing the least significant
// bits of a set of elements.
size_t bitmap32_size = roaring_bitmap_portable_deserialize_size(
Expand All @@ -24663,6 +24666,24 @@ roaring64_bitmap_t *roaring64_bitmap_portable_deserialize_safe(
buf += bitmap32_size;
read_bytes += bitmap32_size;

// While we don't attempt to validate much, we must ensure that there
// is no duplication in the high 48 bits - inserting into the ART
// assumes (or UB) no duplicate keys. The top 32 bits must be unique
// because we check for strict increasing values of high32, but we
// must also ensure the top 16 bits within each 32-bit bitmap are also
// at least unique (we ensure they're strictly increasing as well,
// which they must be for a _valid_ bitmap, since it's cheaper to check)
int32_t last_bitmap_key = -1;
for (int i = 0; i < bitmap32->high_low_container.size; i++) {
uint16_t key = bitmap32->high_low_container.keys[i];
if (key <= last_bitmap_key) {
roaring_bitmap_free(bitmap32);
roaring64_bitmap_free(r);
return NULL;
}
last_bitmap_key = key;
}

// Insert all containers of the 32-bit bitmap into the 64-bit bitmap.
move_from_roaring32_offset(r, bitmap32, high32);
roaring_bitmap_free(bitmap32);
Expand Down
6 changes: 3 additions & 3 deletions croaring-sys/CRoaring/roaring.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-09-19T15:00:26Z
// Created by amalgamation.sh on 2024-09-20T14:21:41Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down Expand Up @@ -59,11 +59,11 @@
// /include/roaring/roaring_version.h automatically generated by release.py, do not change by hand
#ifndef ROARING_INCLUDE_ROARING_VERSION
#define ROARING_INCLUDE_ROARING_VERSION
#define ROARING_VERSION "4.1.4"
#define ROARING_VERSION "4.1.6"
enum {
ROARING_VERSION_MAJOR = 4,
ROARING_VERSION_MINOR = 1,
ROARING_VERSION_REVISION = 4
ROARING_VERSION_REVISION = 6
};
#endif // ROARING_INCLUDE_ROARING_VERSION
// clang-format on/* end file include/roaring/roaring_version.h */
Expand Down
2 changes: 1 addition & 1 deletion croaring-sys/CRoaring/roaring.hh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// !!! DO NOT EDIT - THIS IS AN AUTO-GENERATED FILE !!!
// Created by amalgamation.sh on 2024-09-19T15:00:26Z
// Created by amalgamation.sh on 2024-09-20T14:21:41Z

/*
* The CRoaring project is under a dual license (Apache/MIT).
Expand Down
2 changes: 1 addition & 1 deletion croaring-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "croaring-sys"
version = "4.1.4"
version = "4.1.6"
edition = "2021"
authors = ["croaring-rs developers"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 667e730

Please sign in to comment.