diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2021-10-01 14:21:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2021-10-01 14:21:33 +0200 |
commit | d071b4177c1a3897f4682e245046a45f362b6ac5 (patch) | |
tree | e8af69a24b2b97758d4e7f12a65a93185b9b5890 /test/fuzzers |
Squashed 'deps/md4c/' content from commit 7f05330
git-subtree-dir: deps/md4c
git-subtree-split: 7f0533068b4319d8cb3d0f33ca9aa66a857734a6
Diffstat (limited to 'test/fuzzers')
-rw-r--r-- | test/fuzzers/fuzz-mdhtml.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/fuzzers/fuzz-mdhtml.c b/test/fuzzers/fuzz-mdhtml.c new file mode 100644 index 0000000..62428c8 --- /dev/null +++ b/test/fuzzers/fuzz-mdhtml.c @@ -0,0 +1,28 @@ +#include <stdint.h> +#include <stdlib.h> +#include "md4c-html.h" + +static void +process_output(const MD_CHAR* text, MD_SIZE size, void* userdata) +{ + /* This is dummy function because we dont need any processing on the data */ + return; +} + +int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size){ + if (size < 8) { + return 0; + } + + unsigned int parser_flags = *(unsigned int*)data; + data += 4; size -= 4; + unsigned int renderer_flags = *(unsigned int*)data; + data += 4; size -= 4; + + /* Allocate enough space */ + char *out = malloc(size*3); + md_html(data, size, process_output, out, parser_flags, renderer_flags); + free(out); + + return 0; +} |