File: main.c

package info (click to toggle)
libyang2 2.1.30-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,644 kB
  • sloc: ansic: 111,444; sh: 472; xml: 394; exp: 109; makefile: 15
file content (47 lines) | stat: -rw-r--r-- 676 bytes parent folder | download | duplicates (4)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len);

#ifdef  __AFL_COMPILER

int main(void) {
    int ret;
    uint8_t buf[64 * 1024];

#ifdef __AFL_LOOP
    while (__AFL_LOOP(10000))
#endif
    {
        ret = fread(buf, 1, sizeof(buf), stdin);
        if (ret < 0) {
            return 0;
        }

        LLVMFuzzerTestOneInput(buf, ret);

    }

    return 0;
}

#else

int
main(void)
{
    int ret;
    uint8_t buf[64 * 1024];

    ret = fread(buf, 1, sizeof(buf), stdin);
    if (ret < 0) {
        return 0;
    }

    LLVMFuzzerTestOneInput(buf, ret);

    return 0;
}

#endif /* __AFL_COMPILER */