Skip to content

Commit fc802a9

Browse files
authored
Merge branch 'master' into dependabot/github_actions/actions/checkout-5
2 parents f06a8f0 + 41b96b6 commit fc802a9

File tree

8 files changed

+40
-11
lines changed

8 files changed

+40
-11
lines changed

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fuzz-seconds: 300
2020
dry-run: false
2121
- name: Upload Crash
22-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
22+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2323
if: failure() && steps.build.outcome == 'success'
2424
with:
2525
name: artifacts

.github/workflows/clang-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v5
11-
- uses: DoozyX/clang-format-lint-action@v0.18
11+
- uses: DoozyX/clang-format-lint-action@v0.20
1212
with:
1313
source: '.'
1414
exclude: './cmake'

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ jobs:
3030
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v3.5.2
3131

3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
33+
uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
3434
with:
3535
languages: ${{ matrix.language }}
3636

3737
- name: Autobuild
38-
uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
38+
uses: github/codeql-action/autobuild@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
3939
if: ${{ matrix.language == 'cpp' || matrix.language == 'python' }}
4040

4141
- name: Perform CodeQL Analysis
42-
uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5
42+
uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.30.0
4343
with:
4444
category: "/language:${{ matrix.language }}"

.github/workflows/scorecard.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
persist-credentials: false
3838

3939
- name: "Run analysis"
40-
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
40+
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
4141
with:
4242
results_file: results.sarif
4343
results_format: sarif
@@ -59,14 +59,14 @@ jobs:
5959
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6060
# format to the repository Actions tab.
6161
- name: "Upload artifact"
62-
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
62+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6363
with:
6464
name: SARIF file
6565
path: results.sarif
6666
retention-days: 5
6767

6868
# Upload the results to GitHub's code scanning dashboard.
6969
- name: "Upload to code-scanning"
70-
uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v2.15.1
70+
uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v2.15.1
7171
with:
7272
sarif_file: results.sarif

microbenchmarks/synthetic_bench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
#include <array>
12
#include <benchmark/benchmark.h>
23
#include <random>
34
#include <set>
4-
#include <array>
55

66
#include "performancecounters/event_counter.h"
77
#include "roaring/roaring64.h"

src/roaring.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ roaring_bitmap_t *roaring_bitmap_deserialize_safe(const void *buf,
15961596
for (uint32_t i = 0; i < card; i++) {
15971597
// elems may not be aligned, read with memcpy
15981598
uint32_t elem;
1599-
memcpy((char*)&elem, (char*)(elems + i), sizeof(elem));
1599+
memcpy((char *)&elem, (char *)(elems + i), sizeof(elem));
16001600
roaring_bitmap_add_bulk(bitmap, &context, elem);
16011601
}
16021602
return bitmap;
@@ -3016,7 +3016,7 @@ void roaring_bitmap_frozen_serialize(const roaring_bitmap_t *rb, char *buf) {
30163016
uint16_t *key_zone = (uint16_t *)arena_alloc(&buf, 2 * ra->size);
30173017
uint16_t *count_zone = (uint16_t *)arena_alloc(&buf, 2 * ra->size);
30183018
uint8_t *typecode_zone = (uint8_t *)arena_alloc(&buf, ra->size);
3019-
char *header_zone = (char*)arena_alloc(&buf, 4);
3019+
char *header_zone = (char *)arena_alloc(&buf, 4);
30203020

30213021
for (int32_t i = 0; i < ra->size; i++) {
30223022
uint16_t count;

src/roaring64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2707,6 +2707,8 @@ uint64_t roaring64_iterator_read(roaring64_iterator_t *it, uint64_t *buf,
27072707
it->has_value = art_iterator_next(&it->art_it);
27082708
if (it->has_value) {
27092709
roaring64_iterator_init_at_leaf_first(it);
2710+
} else {
2711+
it->saturated_forward = true;
27102712
}
27112713
}
27122714
return consumed;

tests/roaring64_unit.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,32 @@ DEFINE_TEST(test_stats) {
19741974
roaring64_bitmap_free(r1);
19751975
}
19761976

1977+
DEFINE_TEST(test_iterator_read_past_end_can_go_previous) {
1978+
roaring64_bitmap_t* bitmap = roaring64_bitmap_create();
1979+
assert_non_null(bitmap);
1980+
1981+
roaring64_bitmap_add(bitmap, 10);
1982+
assert_r64_valid(bitmap);
1983+
1984+
roaring64_iterator_t* iter = roaring64_iterator_create(bitmap);
1985+
assert_non_null(iter);
1986+
1987+
uint64_t buffer[100];
1988+
uint64_t actual_read1 = roaring64_iterator_read(
1989+
iter, buffer, sizeof(buffer) / sizeof(buffer[0]));
1990+
assert_int_equal(actual_read1, 1); // Only one value should be present
1991+
1992+
// Should now be one past the end, but should be able to move backwards
1993+
assert_false(roaring64_iterator_has_value(iter));
1994+
bool prev_result = roaring64_iterator_previous(iter);
1995+
assert_true(prev_result);
1996+
assert_true(roaring64_iterator_has_value(iter));
1997+
assert_int_equal(roaring64_iterator_value(iter), 10);
1998+
1999+
roaring64_iterator_free(iter);
2000+
roaring64_bitmap_free(bitmap);
2001+
}
2002+
19772003
} // namespace
19782004

19792005
int main() {
@@ -2038,6 +2064,7 @@ int main() {
20382064
cmocka_unit_test(test_iterator_move_equalorlarger),
20392065
cmocka_unit_test(test_iterator_read),
20402066
cmocka_unit_test(test_stats),
2067+
cmocka_unit_test(test_iterator_read_past_end_can_go_previous),
20412068
};
20422069
return cmocka_run_group_tests(tests, NULL, NULL);
20432070
}

0 commit comments

Comments
 (0)