Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/actions/checkout…
Browse files Browse the repository at this point in the history
…-4.1.0
  • Loading branch information
lemire authored Sep 28, 2023
2 parents 9d1ba32 + 79bec4b commit cff6f00
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fuzz-seconds: 300
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2

- name: Initialize CodeQL
uses: github/codeql-action/init@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
uses: github/codeql-action/init@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
uses: github/codeql-action/autobuild@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
if: ${{ matrix.language == 'cpp' || matrix.language == 'python' }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
uses: github/codeql-action/analyze@6a28655e3dcb49cb0840ea372fd6d17733edd8a4 # v2.21.8
with:
category: "/language:${{ matrix.language }}"
4 changes: 2 additions & 2 deletions .github/workflows/s390x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v3.5.2
- uses: uraimo/run-on-arch-action@a8003307a739516fdd80ee6d3da8924db811b8da # v2.5.0
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: uraimo/run-on-arch-action@4ed76f16f09d12e83abd8a49e1ac1e5bf08784d4 # v2.5.1
name: Test
id: runcmd
with:
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ endif()
set(ROARING_LIB_NAME roaring)
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 1)
set(ROARING_LIB_VERSION "2.0.1" CACHE STRING "Roaring library version")
set(PROJECT_VERSION_PATCH 2)
set(ROARING_LIB_VERSION "2.0.2" CACHE STRING "Roaring library version")
set(ROARING_LIB_SOVERSION "13" CACHE STRING "Roaring library soversion")

option(ROARING_EXCEPTIONS "Enable exception-throwing interface" ON)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@



Portable Roaring bitmaps in C (and C++) with full support for your favorite compiler (GNU GCC, LLVM's clang, Visual Studio). Included in the [Awesome C](https://github.com/kozross/awesome-c) list of open source C software.
Portable Roaring bitmaps in C (and C++) with full support for your favorite compiler (GNU GCC, LLVM's clang, Visual Studio, Apple Xcode, Intel oneAPI). Included in the [Awesome C](https://github.com/kozross/awesome-c) list of open source C software.

# Introduction

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 = "2.0.1"
PROJECT_NUMBER = "2.0.2"

# 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
10 changes: 5 additions & 5 deletions fuzz/croaring_fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ int LLVMFuzzerTestOneInput(const char *data, size_t size) {
// The bitmap may not be usable if it does not follow the specification.
// We can validate the bitmap we recovered to make sure it is proper.
const char *reason_failure = NULL;
if (roaring_bitmap_internal_validate(t, &reason_failure)) {
if (roaring_bitmap_internal_validate(bitmap, &reason_failure)) {
// the bitmap is ok!
uint32_t cardinality = roaring_bitmap_get_cardinality(t);
uint32_t cardinality = roaring_bitmap_get_cardinality(bitmap);

for (uint32_t i = 100; i < 1000; i++) {
if (!roaring_bitmap_contains(t, i)) {
if (!roaring_bitmap_contains(bitmap, i)) {
cardinality++;
roaring_bitmap_add(r1, i);
roaring_bitmap_add(bitmap, i);
}
}
uint32_t new_cardinality = roaring_bitmap_get_cardinality(t);
uint32_t new_cardinality = roaring_bitmap_get_cardinality(bitmap);
if (cardinality != new_cardinality) {
printf("bug\n");
exit(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 "2.0.1"
#define ROARING_VERSION "2.0.2"
enum {
ROARING_VERSION_MAJOR = 2,
ROARING_VERSION_MINOR = 0,
ROARING_VERSION_REVISION = 1
ROARING_VERSION_REVISION = 2
};
#endif // ROARING_INCLUDE_ROARING_VERSION
5 changes: 4 additions & 1 deletion src/containers/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,10 @@ bool run_container_validate(const run_container_t *run, const char **reason) {
*reason = "run start + length overflow";
return false;
}

if (end > (1<<16)) {
*reason = "run start + length too large";
return false;
}
if (start < last_end) {
*reason = "run start less than last end";
return false;
Expand Down
38 changes: 38 additions & 0 deletions tests/toplevel_unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4595,10 +4595,48 @@ DEFINE_TEST(convert_to_bitset) {
roaring_bitmap_free(r1);
}


bool deserialization_test(const char *data, size_t size) {
// We test that deserialization never fails.
roaring_bitmap_t *bitmap =
roaring_bitmap_portable_deserialize_safe(data, size);
if (bitmap) {
// The bitmap may not be usable if it does not follow the specification.
// We can validate the bitmap we recovered to make sure it is proper.
const char *reason_failure = NULL;
if (roaring_bitmap_internal_validate(bitmap, &reason_failure)) {
// the bitmap is ok!
uint32_t cardinality = roaring_bitmap_get_cardinality(bitmap);

for (uint32_t i = 100; i < 1000; i++) {
if (!roaring_bitmap_contains(bitmap, i)) {
cardinality++;
roaring_bitmap_add(bitmap, i);
}
}

uint32_t new_cardinality = roaring_bitmap_get_cardinality(bitmap);
if (cardinality != new_cardinality) {
return false;
}
}
roaring_bitmap_free(bitmap);
}
return true;
}

DEFINE_TEST(robust_deserialization) {
assert_true(deserialization_test(NULL, 0));
// contains a run container that overflows the 16-bit boundary.
const char test1[] = "\x3b\x30\x00\x00\x01\x00\x00\xfa\x2e\x01\x00\x00\x02\xff\xff";
assert_true(deserialization_test(test1, sizeof(test1)));
}

int main() {
tellmeall();

const struct CMUnitTest tests[] = {
cmocka_unit_test(robust_deserialization),
cmocka_unit_test(issue457),
cmocka_unit_test(convert_to_bitset),
cmocka_unit_test(issue440),
Expand Down
6 changes: 4 additions & 2 deletions tools/cmake/FindCTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ if (CMAKE_VERSION VERSION_GREATER 3.0.0)
endif ()
include(${PROJECT_SOURCE_DIR}/tools/cmake/Import.cmake)
set(BUILD_STATIC_LIB ON)
import_dependency(cmocka clibs/cmocka f5e2cd7)
add_dependency(cmocka)
if (ENABLE_ROARING_TESTS)
import_dependency(cmocka clibs/cmocka f5e2cd7)
add_dependency(cmocka)
endif()

function(add_c_test TEST_NAME)
if(ROARING_BUILD_C_TESTS_AS_CPP) # under C++, container_t* != void*
Expand Down

0 comments on commit cff6f00

Please sign in to comment.