summaryrefslogtreecommitdiffstats
path: root/src/tests/fuzz/options.c
blob: c88e462f1b729e3c30865d9f67a438d9a4f0ea7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../tests.h"

#include <libplacebo/options.h>

__AFL_FUZZ_INIT();

#pragma clang optimize off

int main()
{
    pl_options opts = pl_options_alloc(NULL);

#ifdef __AFL_HAVE_MANUAL_CONTROL
    __AFL_INIT();
#endif

    unsigned char *buf = __AFL_FUZZ_TESTCASE_BUF;

    while (__AFL_LOOP(100000)) {
        size_t len = __AFL_FUZZ_TESTCASE_LEN;
        buf[len - 1] = '\0'; // ensure proper null termination
        pl_options_load(opts, (const char *) buf);
        pl_options_save(opts);
        pl_options_reset(opts, NULL);
    }
}