Coverage Report

Created: 2025-07-12 06:30

/src/miniz/tests/checksum_fuzzer.c
Line
Count
Source
1
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
2
 * see ossfuzz.sh for full license text.
3
 */
4
5
#include <stddef.h>
6
#include <stdint.h>
7
#include <inttypes.h>
8
9
#include "miniz.h"
10
11
static const size_t kMaxSize = 1024 * 1024;
12
13
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen)
14
5.14k
{
15
    /* Discard inputs larger than 1Mb. */
16
5.14k
    if (dataLen < 1 || dataLen > kMaxSize)
17
5
        return 0;
18
19
5.13k
    uint32_t crc = crc32(0L, NULL, 0);
20
5.13k
    uint32_t adler = adler32(0L, NULL, 0);
21
22
5.13k
    crc = crc32(crc, data, (uint32_t)dataLen);
23
5.13k
    adler = adler32(adler, data, (uint32_t)dataLen);
24
25
5.13k
    return 0;
26
5.14k
}