Coverage Report

Created: 2025-11-16 06:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/md4c/test/fuzzers/fuzz-mdhtml.c
Line
Count
Source
1
2
#include <stdint.h>
3
#include <stdlib.h>
4
#include "md4c-html.h"
5
6
7
static void
8
process_output(const MD_CHAR* text, MD_SIZE size, void* userdata)
9
129M
{
10
   /* This is a dummy function because we don't need to generate any output
11
    * actually. */
12
129M
   return;
13
129M
}
14
15
int
16
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
17
15.6k
{
18
15.6k
    unsigned parser_flags, renderer_flags;
19
20
    /* We interpret the 1st 8 bytes as parser flags and renderer flags. */
21
15.6k
    if(size < 2 * sizeof(unsigned)) {
22
4
        return 0;
23
4
    }
24
15.6k
    parser_flags = ((unsigned*)data)[0];
25
15.6k
    renderer_flags = ((unsigned*)data)[1];
26
15.6k
    data += 2 * sizeof(unsigned);
27
15.6k
    size -= 2 * sizeof(unsigned);
28
29
    md_html(data, size, process_output, NULL, parser_flags, renderer_flags);
30
15.6k
    return 0;
31
15.6k
}