summaryrefslogtreecommitdiff
path: root/src/fuzz/fuzz.h
blob: d7cbb0bb1649f4231e552d26417ff15d8a44c81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once

#include <stddef.h>
#include <stdint.h>

#include "fileio.h"

/* The entry point into the fuzzer */
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);

static inline FILE* data_to_file(const uint8_t *data, size_t size) {
        if (size == 0)
                return fopen("/dev/null", "re");
        else
                return fmemopen_unlocked((char*) data, size, "re");
}