diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c | |
parent | Initial commit. (diff) | |
download | netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.tar.xz netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c')
-rw-r--r-- | fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c b/fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c new file mode 100644 index 00000000..bcd2ca58 --- /dev/null +++ b/fluent-bit/tests/internal/fuzzers/ctrace_fuzzer.c @@ -0,0 +1,24 @@ +#include <stdint.h> +#include <fluent-bit/flb_mem.h> +#include <ctraces/ctraces.h> +#include <ctraces/ctr_decode_msgpack.h> + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){ + size_t off = 0; + struct ctrace *ctr = NULL; + size_t msgpack_text_size; + char *msgpack_text_buffer = NULL; + + /* Set fuzzer-malloc chance of failure */ + flb_malloc_p = 0; + flb_malloc_mod = 25000; + + ctr_decode_msgpack_create(&ctr, data, size, &off); + if (ctr != NULL) { + ctr_encode_msgpack_create(ctr, &msgpack_text_buffer, &msgpack_text_size); + ctr_encode_msgpack_destroy(msgpack_text_buffer); + + ctr_destroy(ctr); + } + return 0; +} |