Skip to content

preparing patch release and fixing issue 722 #723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: |
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON ..
cmake -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON -DROARING_UNSAFE_FROZEN_TESTS=ON ..
cmake --build .
ctest . --output-on-failure
cmake --install .
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
mkdir builddebug
cd builddebug
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=destination -DENABLE_ROARING_TESTS=ON -DROARING_UNSAFE_FROZEN_TESTS=ON ..
cmake --build .
ctest . --output-on-failure
cmake --install .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vs17-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Configure
run: |
mkdir build
cd build && cmake -DENABLE_ROARING_TESTS=ON -G "${{matrix.gen}}" -A ${{matrix.arch}} ..
cd build && cmake -DENABLE_ROARING_TESTS=ON -DROARING_UNSAFE_FROZEN_TESTS=ON -G "${{matrix.gen}}" -A ${{matrix.arch}} ..
- name: Build
run: cmake --build build --config Release
- name: Run basic tests
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ endif()
set(ROARING_LIB_NAME roaring)
set(PROJECT_VERSION_MAJOR 4)
set(PROJECT_VERSION_MINOR 3)
set(PROJECT_VERSION_PATCH 5)
set(ROARING_LIB_VERSION "4.3.5" CACHE STRING "Roaring library version")
set(PROJECT_VERSION_PATCH 6)
set(ROARING_LIB_VERSION "4.3.6" CACHE STRING "Roaring library version")
set(ROARING_LIB_SOVERSION "18" CACHE STRING "Roaring library soversion")

option(ROARING_EXCEPTIONS "Enable exception-throwing interface" ON)
Expand All @@ -48,6 +48,7 @@ option(ROARING_BUILD_C_TESTS_AS_CPP "Build test C files using C++ compilation" O
option(ROARING_SANITIZE "Sanitize addresses" OFF)
option(ROARING_SANITIZE_THREADS "Sanitize threads" OFF)
option(ROARING_SANITIZE_UNDEFINED "Sanitize undefined behaviors" OFF)
option(ROARING_UNSAFE_FROZEN_TESTS "If ON, tests some frozen functions which are unsafe as they include unaligned reads, this can cause crashes" OFF)

option(ENABLE_ROARING_TESTS "If OFF, disable unit tests altogether" ON)
if(NOT ENABLE_ROARING_TESTS)
Expand Down
7 changes: 7 additions & 0 deletions cpp/roaring/roaring64map.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,9 @@ class Roaring64Map {
});
}

/**
* For advanced users only.
*/
static const Roaring64Map frozenView(const char *buf) {
// size of bitmap buffer and key
const size_t metadata_size = sizeof(size_t) + sizeof(uint32_t);
Expand Down Expand Up @@ -1284,6 +1287,10 @@ class Roaring64Map {
return result;
}

/**
* For advanced users only. This function is unsafe in the sense that
* that it may trigger unaligned memory access. Use with caution.
*/
static const Roaring64Map portableDeserializeFrozen(const char *buf) {
Roaring64Map result;
// get map size
Expand Down
2 changes: 1 addition & 1 deletion doxygen
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "CRoaring"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "4.3.5"
PROJECT_NUMBER = "4.3.6"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
4 changes: 2 additions & 2 deletions include/roaring/roaring_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,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.3.5"
#define ROARING_VERSION "4.3.6"
enum {
ROARING_VERSION_MAJOR = 4,
ROARING_VERSION_MINOR = 3,
ROARING_VERSION_REVISION = 5
ROARING_VERSION_REVISION = 6
};
#endif // ROARING_INCLUDE_ROARING_VERSION
// clang-format on
8 changes: 3 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
### This code is buggy because it does not ensure that all variables have been defined :
#set (TEST_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/testdata/")
#configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
# "${CMAKE_CURRENT_SOURCE_DIR}/config.h")


if(ROARING_UNSAFE_FROZEN_TESTS)
add_compile_definitions(ROARING_UNSAFE_FROZEN_TESTS=1)
endif()
add_cpp_test(cpp_unit)
add_cpp_test(cpp_random_unit)
add_cpp_test(cpp_example1)
Expand Down
10 changes: 10 additions & 0 deletions tests/cpp_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,9 @@ DEFINE_TEST(test_cpp_frozen_64) {
roaring_aligned_free(buf);
}

#if ROARING_UNSAFE_FROZEN_TESTS
// This test is unsafe, as it may trigger unaligned memory access
// It is only enabled if ROARING_UNSAFE_FROZEN_TESTS is defined.
DEFINE_TEST(test_cpp_frozen_portable) {
const uint64_t s = 65536;

Expand Down Expand Up @@ -1548,7 +1551,11 @@ DEFINE_TEST(test_cpp_frozen_portable) {

free(buf);
}
#endif // ROARING_UNSAFE_FROZEN_TESTS

#if ROARING_UNSAFE_FROZEN_TESTS
// This test is unsafe, as it may trigger unaligned memory access
// It is only enabled if ROARING_UNSAFE_FROZEN_TESTS is defined.
DEFINE_TEST(test_cpp_frozen_64_portable) {
const uint64_t s = 65536;

Expand Down Expand Up @@ -1611,6 +1618,7 @@ DEFINE_TEST(test_cpp_frozen_64_portable) {

free(buf);
}
#endif // ROARING_UNSAFE_FROZEN_TESTS

DEFINE_TEST(test_cpp_flip) {
{
Expand Down Expand Up @@ -2207,8 +2215,10 @@ int main() {
cmocka_unit_test(test_cpp_bidirectional_iterator_64),
cmocka_unit_test(test_cpp_frozen),
cmocka_unit_test(test_cpp_frozen_64),
#if ROARING_UNSAFE_FROZEN_TESTS
cmocka_unit_test(test_cpp_frozen_portable),
cmocka_unit_test(test_cpp_frozen_64_portable),
#endif // ROARING_UNSAFE_FROZEN_TESTS
cmocka_unit_test(test_cpp_flip),
cmocka_unit_test(test_cpp_flip_closed),
cmocka_unit_test(test_cpp_flip_64),
Expand Down
6 changes: 6 additions & 0 deletions tests/toplevel_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4562,6 +4562,9 @@ DEFINE_TEST(test_frozen_serialization_max_containers) {
frozen_serialization_compare(r);
}

#if ROARING_UNSAFE_FROZEN_TESTS
// This test is unsafe, as it may trigger unaligned memory access
// It is only enabled if ROARING_UNSAFE_FROZEN_TESTS is defined.
DEFINE_TEST(test_portable_deserialize_frozen) {
roaring_bitmap_t *r1 =
roaring_bitmap_from(1, 2, 3, 100, 1000, 10000, 1000000, 20000000);
Expand Down Expand Up @@ -4655,6 +4658,7 @@ DEFINE_TEST(test_portable_deserialize_frozen) {
roaring_bitmap_free(r2);
free(serialized);
}
#endif // ROARING_UNSAFE_FROZEN_TESTS

DEFINE_TEST(convert_to_bitset) {
roaring_bitmap_t *r1 = roaring_bitmap_create();
Expand Down Expand Up @@ -4981,7 +4985,9 @@ int main() {
#if !CROARING_IS_BIG_ENDIAN
cmocka_unit_test(test_frozen_serialization),
cmocka_unit_test(test_frozen_serialization_max_containers),
#if ROARING_UNSAFE_FROZEN_TESTS
cmocka_unit_test(test_portable_deserialize_frozen),
#endif // ROARING_UNSAFE_FROZEN_TESTS
cmocka_unit_test(issue_15jan2024),
#endif
};
Expand Down
Loading