diff options
| author | robot-contrib <[email protected]> | 2025-03-11 12:28:48 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2025-03-11 12:46:19 +0300 |
| commit | 58504ff35cdeb2294dfc4eaa103fbaa5d7a64aca (patch) | |
| tree | 3b16cd99caf8a5b7f1e61c693ee8c0685f7e5560 | |
| parent | 6ec8a1abaec4fef4224181cb6a95388eae0f8187 (diff) | |
Update contrib/libs/croaring to 4.2.2
commit_hash:c280244119ed11fb444a5d9dfb86dc84d4246358
| -rw-r--r-- | contrib/libs/croaring/.yandex_meta/override.nix | 4 | ||||
| -rw-r--r-- | contrib/libs/croaring/README.md | 16 | ||||
| -rw-r--r-- | contrib/libs/croaring/include/roaring/bitset/bitset.h | 3 | ||||
| -rw-r--r-- | contrib/libs/croaring/include/roaring/portability.h | 7 | ||||
| -rw-r--r-- | contrib/libs/croaring/include/roaring/roaring.h | 16 | ||||
| -rw-r--r-- | contrib/libs/croaring/include/roaring/roaring64.h | 11 | ||||
| -rw-r--r-- | contrib/libs/croaring/include/roaring/roaring_version.h | 4 | ||||
| -rw-r--r-- | contrib/libs/croaring/src/art/art.c | 4 | ||||
| -rw-r--r-- | contrib/libs/croaring/src/roaring64.c | 13 | ||||
| -rw-r--r-- | contrib/libs/croaring/ya.make | 4 |
10 files changed, 42 insertions, 40 deletions
diff --git a/contrib/libs/croaring/.yandex_meta/override.nix b/contrib/libs/croaring/.yandex_meta/override.nix index 7c23a64e1a2..b259cae422d 100644 --- a/contrib/libs/croaring/.yandex_meta/override.nix +++ b/contrib/libs/croaring/.yandex_meta/override.nix @@ -1,12 +1,12 @@ pkgs: attrs: with pkgs; with attrs; rec { pname = "croaring"; - version = "4.2.1"; + version = "4.2.2"; src = fetchFromGitHub { owner = "RoaringBitmap"; repo = "CRoaring"; rev = "v${version}"; - hash = "sha256-qOFkDu0JM+wBIlGGyewojicCp2pmtr643J3dW6el+O4="; + hash = "sha256-QaCYtuUU7hZ03x/bPEGG7jUlzbRNMGwi9s/hIHyd3U4="; }; patches = []; diff --git a/contrib/libs/croaring/README.md b/contrib/libs/croaring/README.md index 0f938004c97..08e2d4c46ec 100644 --- a/contrib/libs/croaring/README.md +++ b/contrib/libs/croaring/README.md @@ -419,14 +419,17 @@ int main() { // otherwise the result may be unusable. // The 'roaring_bitmap_portable_deserialize_safe' function will not read // beyond expectedsize bytes. - // We recommend you further use checksums to make sure that the input is from - // serialized data. + // We also recommend that you use checksums to check that serialized data corresponds + // to the serialized bitmap. The CRoaring library does not provide checksumming. roaring_bitmap_t *t = roaring_bitmap_portable_deserialize_safe(serializedbytes, expectedsize); if(t == NULL) { return EXIT_FAILURE; } const char *reason = NULL; + // If your input came from an untrusted source, then you need to validate the + // resulting bitmap. Failing to do so could lead to undefined behavior, crashes and so forth. if (!roaring_bitmap_internal_validate(t, &reason)) { return EXIT_FAILURE; } + // At this point, the bitmap is safe. assert(roaring_bitmap_equals(r1, t)); // what we recover is equal roaring_bitmap_free(t); // we can also check whether there is a bitmap at a memory location without @@ -438,8 +441,8 @@ int main() { // We can also read the bitmap "safely" by specifying a byte size limit. // The 'roaring_bitmap_portable_deserialize_safe' function will not read // beyond expectedsize bytes. - // We recommend you further use checksums to make sure that the input is from - // serialized data. + // We also recommend that you use checksums to check that serialized data corresponds + // to the serialized bitmap. The CRoaring library does not provide checksumming. t = roaring_bitmap_portable_deserialize_safe(serializedbytes, expectedsize); if(t == NULL) { printf("Problem during deserialization.\n"); @@ -447,15 +450,14 @@ int main() { return EXIT_FAILURE; } // We can validate the bitmap we recovered to make sure it is proper. + // If the data came from an untrusted source, you should call + // roaring_bitmap_internal_validate. const char *reason_failure = NULL; if (!roaring_bitmap_internal_validate(t, &reason_failure)) { printf("safely deserialized invalid bitmap: %s\n", reason_failure); // We could clear any memory and close any file here. return EXIT_FAILURE; } - // It is still necessary for the content of seriallizedbytes to follow - // the standard: https://github.com/RoaringBitmap/RoaringFormatSpec - // This is guaranted when calling 'roaring_bitmap_portable_deserialize'. assert(roaring_bitmap_equals(r1, t)); // what we recover is equal roaring_bitmap_free(t); diff --git a/contrib/libs/croaring/include/roaring/bitset/bitset.h b/contrib/libs/croaring/include/roaring/bitset/bitset.h index 38ed39e8062..22062ca4e57 100644 --- a/contrib/libs/croaring/include/roaring/bitset/bitset.h +++ b/contrib/libs/croaring/include/roaring/bitset/bitset.h @@ -236,7 +236,8 @@ inline size_t bitset_next_set_bits(const bitset_t *bitset, size_t *buffer, return 0; // nothing more to iterate over } uint64_t w = bitset->array[x]; - w >>= (*startfrom & 63); + // unset low bits inside the word less than *startfrom + w &= ~((UINT64_C(1) << (*startfrom & 63)) - 1); size_t howmany = 0; size_t base = x << 6; while (howmany < capacity) { diff --git a/contrib/libs/croaring/include/roaring/portability.h b/contrib/libs/croaring/include/roaring/portability.h index 897feedbf8b..2db112504ce 100644 --- a/contrib/libs/croaring/include/roaring/portability.h +++ b/contrib/libs/croaring/include/roaring/portability.h @@ -16,9 +16,10 @@ #ifndef CROARING_INCLUDE_PORTABILITY_H_ #define CROARING_INCLUDE_PORTABILITY_H_ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif // _GNU_SOURCE +// Users who need _GNU_SOURCE should define it? +// #ifndef _GNU_SOURCE +// #define _GNU_SOURCE 1 +// #endif // _GNU_SOURCE #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS 1 #endif // __STDC_FORMAT_MACROS diff --git a/contrib/libs/croaring/include/roaring/roaring.h b/contrib/libs/croaring/include/roaring/roaring.h index 7880e3f3d91..430abfe182f 100644 --- a/contrib/libs/croaring/include/roaring/roaring.h +++ b/contrib/libs/croaring/include/roaring/roaring.h @@ -649,11 +649,14 @@ roaring_bitmap_t *roaring_bitmap_portable_deserialize(const char *buf); * order. This is is guaranteed to happen when serializing an existing bitmap, * but not for random inputs. * - * You may use roaring_bitmap_internal_validate to check the validity of the - * bitmap prior to using it. + * If the source is untrusted, you should call + * roaring_bitmap_internal_validate to check the validity of the + * bitmap prior to using it. Only after calling roaring_bitmap_internal_validate + * is the bitmap considered safe for use. * - * We recommend that you use checksums to check that serialized data corresponds - * to a serialized bitmap. + * We also recommend that you use checksums to check that serialized data + * corresponds to the serialized bitmap. The CRoaring library does not provide + * checksumming. * * 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 @@ -1183,3 +1186,8 @@ CROARING_DEPRECATED static inline uint32_t roaring_read_uint32_iterator( using namespace ::roaring::api; #endif #endif + +// roaring64 will include roaring.h, but we would +// prefer to avoid having our users include roaring64.h +// in addition to roaring.h. +#include <roaring/roaring64.h> diff --git a/contrib/libs/croaring/include/roaring/roaring64.h b/contrib/libs/croaring/include/roaring/roaring64.h index c1f574d6050..8022f160dd4 100644 --- a/contrib/libs/croaring/include/roaring/roaring64.h +++ b/contrib/libs/croaring/include/roaring/roaring64.h @@ -548,11 +548,14 @@ size_t roaring64_bitmap_portable_deserialize_size(const char *buf, * 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. + * If the source is untrusted, you should call + * roaring64_bitmap_internal_validate to check the validity of the + * bitmap prior to using it. Only after calling + * roaring64_bitmap_internal_validate is the bitmap considered safe for use. * - * We recommend that you use checksums to check that serialized data corresponds - * to a serialized bitmap. + * We also recommend that you use checksums to check that serialized data + * corresponds to the serialized bitmap. The CRoaring library does not provide + * checksumming. * * 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 diff --git a/contrib/libs/croaring/include/roaring/roaring_version.h b/contrib/libs/croaring/include/roaring/roaring_version.h index aad63adecb3..84618b27cae 100644 --- a/contrib/libs/croaring/include/roaring/roaring_version.h +++ b/contrib/libs/croaring/include/roaring/roaring_version.h @@ -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.2.1" +#define ROARING_VERSION "4.2.2" enum { ROARING_VERSION_MAJOR = 4, ROARING_VERSION_MINOR = 2, - ROARING_VERSION_REVISION = 1 + ROARING_VERSION_REVISION = 2 }; #endif // ROARING_INCLUDE_ROARING_VERSION // clang-format on
\ No newline at end of file diff --git a/contrib/libs/croaring/src/art/art.c b/contrib/libs/croaring/src/art/art.c index dc2f17a5d9a..7bca7eb2c98 100644 --- a/contrib/libs/croaring/src/art/art.c +++ b/contrib/libs/croaring/src/art/art.c @@ -1318,7 +1318,7 @@ static art_val_t *art_find_at(const art_node_t *node, } // Returns the size in bytes of the subtrie. -size_t art_size_in_bytes_at(const art_node_t *node) { +static size_t art_size_in_bytes_at(const art_node_t *node) { if (art_is_leaf(node)) { return 0; } @@ -1372,7 +1372,7 @@ static void art_node_print_type(const art_node_t *node) { } } -void art_node_printf(const art_node_t *node, uint8_t depth) { +static void art_node_printf(const art_node_t *node, uint8_t depth) { if (art_is_leaf(node)) { printf("{ type: Leaf, key: "); art_leaf_t *leaf = CROARING_CAST_LEAF(node); diff --git a/contrib/libs/croaring/src/roaring64.c b/contrib/libs/croaring/src/roaring64.c index 914faefe0b5..208c198de7f 100644 --- a/contrib/libs/croaring/src/roaring64.c +++ b/contrib/libs/croaring/src/roaring64.c @@ -262,19 +262,6 @@ roaring64_bitmap_t *roaring64_bitmap_of_ptr(size_t n_args, return r; } -roaring64_bitmap_t *roaring64_bitmap_of(size_t n_args, ...) { - roaring64_bitmap_t *r = roaring64_bitmap_create(); - roaring64_bulk_context_t context = CROARING_ZERO_INITIALIZER; - va_list ap; - va_start(ap, n_args); - for (size_t i = 0; i < n_args; i++) { - uint64_t val = va_arg(ap, uint64_t); - roaring64_bitmap_add_bulk(r, &context, val); - } - va_end(ap); - return r; -} - static inline leaf_t *containerptr_roaring64_bitmap_add(roaring64_bitmap_t *r, uint8_t *high48, uint16_t low16, diff --git a/contrib/libs/croaring/ya.make b/contrib/libs/croaring/ya.make index 63e87a8b2ad..40a975908de 100644 --- a/contrib/libs/croaring/ya.make +++ b/contrib/libs/croaring/ya.make @@ -10,9 +10,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(4.2.1) +VERSION(4.2.2) -ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.2.1.tar.gz) +ORIGINAL_SOURCE(https://github.com/RoaringBitmap/CRoaring/archive/v4.2.2.tar.gz) ADDINCL( GLOBAL contrib/libs/croaring/include |
