From ecc8e06f1dc41ace254bc0bfa7730efde700d724 Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Wed, 2 Oct 2024 09:28:57 -0400 Subject: [PATCH] separating out the 32-bit and 64-bit fuzzers (#672) * separating out the 32-bit and 64-bit fuzzers * lint * missing header --- fuzz/croaring_fuzzer.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fuzz/croaring_fuzzer.c b/fuzz/croaring_fuzzer.c index 4c652378..8f65ac51 100644 --- a/fuzz/croaring_fuzzer.c +++ b/fuzz/croaring_fuzzer.c @@ -19,6 +19,7 @@ #include #include "roaring/roaring.h" +#include "roaring/roaring64.h" int bitmap32(const char *data, size_t size) { // We test that deserialization never fails. @@ -77,15 +78,14 @@ int bitmap64(const char *data, size_t size) { } return 0; } + int LLVMFuzzerTestOneInput(const char *data, size_t size) { - int r; - r = bitmap32(data, size); - if (r) { - return r; + if (size == 0) { + return 0; } - r = bitmap64(data, size); - if (r) { - return r; + if (data[0] % 2 == 0) { + return bitmap32(data + 1, size - 1); + } else { + return bitmap64(data + 1, size - 1); } - return 0; }