Coverage Report

Created: 2025-07-11 06:25

/src/miniz/tests/uncompress_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 <string.h>
8
9
#include "miniz.h"
10
11
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
12
1.00k
{
13
1.00k
    unsigned long int buffer_length = 1;
14
1.00k
    unsigned char *buffer = NULL;
15
1.00k
    int z_status = 0;
16
17
1.00k
    if (size > 0)
18
1.00k
        buffer_length *= data[0];
19
1.00k
    if (size > 1)
20
1.00k
        buffer_length *= data[1];
21
22
1.00k
    buffer = (unsigned char *)malloc(buffer_length);
23
24
1.00k
    z_status = uncompress(buffer, &buffer_length, data, size);
25
1.00k
    free(buffer);
26
27
1.00k
    if (Z_OK != z_status)
28
1.00k
        return 0;
29
1
    return 0;
30
1.00k
}