summaryrefslogtreecommitdiffstats
path: root/src/tests/fuzz/user_shaders.c
blob: bbb98c8902269dd4de2f984a48593aeefa3953b3 (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
27
28
#include "../tests.h"

#include <libplacebo/dummy.h>
#include <libplacebo/shaders/custom.h>

__AFL_FUZZ_INIT();

#pragma clang optimize off

int main()
{
    pl_gpu gpu = pl_gpu_dummy_create(NULL, NULL);
    const struct pl_hook *hook;

#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;
        hook = pl_mpv_user_shader_parse(gpu, (char *) buf, len);
        pl_mpv_user_shader_destroy(&hook);
    }

    pl_gpu_dummy_destroy(&gpu);
}