Skip to content

Commit

Permalink
Patch release (better guard for add_range)
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Feb 28, 2023
1 parent 11b1ddb commit 18bcee8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ endif()
set(ROARING_LIB_NAME roaring)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 9)
set(PROJECT_VERSION_PATCH 8)
set(ROARING_LIB_VERSION "0.9.8" CACHE STRING "Roaring library version")
set(PROJECT_VERSION_PATCH 9)
set(ROARING_LIB_VERSION "0.9.9" CACHE STRING "Roaring library version")
set(ROARING_LIB_SOVERSION "7" CACHE STRING "Roaring library soversion")

option(ROARING_EXCEPTIONS "Enable exception-throwing interface" ON)
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 = "0.9.8"
PROJECT_NUMBER = "0.9.9"

# 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.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void roaring_bitmap_add_range_closed(roaring_bitmap_t *r,
*/
static inline void roaring_bitmap_add_range(roaring_bitmap_t *r,
uint64_t min, uint64_t max) {
if(max == min) return;
if(max <= min) return;
roaring_bitmap_add_range_closed(r, (uint32_t)min, (uint32_t)(max - 1));
}

Expand All @@ -353,7 +353,7 @@ void roaring_bitmap_remove_range_closed(roaring_bitmap_t *r,
*/
static inline void roaring_bitmap_remove_range(roaring_bitmap_t *r,
uint64_t min, uint64_t max) {
if(max == min) return;
if(max <= min) return;
roaring_bitmap_remove_range_closed(r, (uint32_t)min, (uint32_t)(max - 1));
}

Expand Down
4 changes: 2 additions & 2 deletions include/roaring/roaring_version.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// /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 "0.9.8"
#define ROARING_VERSION "0.9.9"
enum {
ROARING_VERSION_MAJOR = 0,
ROARING_VERSION_MINOR = 9,
ROARING_VERSION_REVISION = 8
ROARING_VERSION_REVISION = 9
};
#endif // ROARING_INCLUDE_ROARING_VERSION
8 changes: 8 additions & 0 deletions tests/cpp_unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ bool roaring_iterator_sumall64(uint64_t value, void *param) {
return true; // we always process all values
}


DEFINE_TEST(fuzz_001) {
roaring::Roaring b;
b.addRange(173, 0);
assert_true(b.cardinality() == 0);
}

DEFINE_TEST(serial_test) {
uint32_t values[] = {5, 2, 3, 4, 1};
Roaring r1(sizeof(values) / sizeof(uint32_t), values);
Expand Down Expand Up @@ -1944,6 +1951,7 @@ DEFINE_TEST(test_cpp_contains_range_interleaved_containers) {
int main() {
roaring::misc::tellmeall();
const struct CMUnitTest tests[] = {
cmocka_unit_test(fuzz_001),
cmocka_unit_test(test_bitmap_of_32),
cmocka_unit_test(test_bitmap_of_64),
cmocka_unit_test(serial_test),
Expand Down

0 comments on commit 18bcee8

Please sign in to comment.