aboutsummaryrefslogtreecommitdiff
path: root/contrib/libcbor/test/fuzz_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libcbor/test/fuzz_test.c')
-rw-r--r--contrib/libcbor/test/fuzz_test.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/contrib/libcbor/test/fuzz_test.c b/contrib/libcbor/test/fuzz_test.c
index 885424107bf1..a02ed7ea9287 100644
--- a/contrib/libcbor/test/fuzz_test.c
+++ b/contrib/libcbor/test/fuzz_test.c
@@ -5,13 +5,8 @@
* it under the terms of the MIT license. See LICENSE for details.
*/
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stddef.h>
-
-#include <cmocka.h>
-
#include <time.h>
+#include "assertions.h"
#include "cbor.h"
#ifdef HUGE_FUZZ
@@ -31,16 +26,14 @@ static void printmem(const unsigned char *ptr, size_t length) {
unsigned seed;
-#if CBOR_CUSTOM_ALLOC
void *mock_malloc(size_t size) {
if (size > (1 << 19))
return NULL;
else
return malloc(size);
}
-#endif
-static void run_round() {
+static void run_round(void) {
cbor_item_t *item;
struct cbor_load_result res;
@@ -62,10 +55,8 @@ static void run_round() {
free(data);
}
-static void fuzz(void **state) {
-#if CBOR_CUSTOM_ALLOC
+static void fuzz(void **_CBOR_UNUSED(_state)) {
cbor_set_allocs(mock_malloc, realloc, free);
-#endif
printf("Fuzzing %llu rounds of up to %llu bytes with seed %u\n", ROUNDS,
MAXLEN, seed);
srand(seed);