summaryrefslogtreecommitdiffstats
path: root/fluent-bit/tests/internal/fuzzers/base64_fuzzer.c
blob: 90c4c08f6b477bfa94085eb8bbbab022f7dfca63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <unistd.h>
#include <stdint.h>
#include <fluent-bit/flb_base64.h>
#include <fluent-bit/flb_mem.h>

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
    char out[100];
    size_t olen;

    /* Set fuzzer-malloc chance of failure */
    flb_malloc_p = 0;
    flb_malloc_mod = 25000;

    flb_base64_encode((unsigned char *) out, 100,
                      &olen, (unsigned char *)data, size);
    flb_base64_decode((unsigned char *) out, 100,
                      &olen, (unsigned char *)data, size);
    return 0;
}