Coverage Report

Created: 2025-12-25 06:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/c-blosc/tests/fuzz/fuzz_decompress.c
Line
Count
Source
1
#include <stdint.h>
2
#include <stdlib.h>
3
4
#include "blosc.h"
5
6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
10
8.97k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
11
8.97k
  size_t nbytes, cbytes, blocksize;
12
8.97k
  void *output;
13
14
8.97k
  if (size < BLOSC_MIN_HEADER_LENGTH) {
15
6
    return 0;
16
6
  }
17
18
8.96k
  blosc_cbuffer_sizes(data, &nbytes, &cbytes, &blocksize);
19
8.96k
  if (cbytes != size) {
20
105
    return 0;
21
105
  }
22
8.86k
  if (nbytes == 0) {
23
1
    return 0;
24
1
  }
25
  
26
8.86k
  if (blosc_cbuffer_validate(data, size, &nbytes) != 0) {
27
    /* Unexpected nbytes specified in blosc header */
28
59
    return 0;
29
59
  }
30
31
8.80k
  output = malloc(cbytes);
32
8.80k
  if (output != NULL) {
33
8.80k
    blosc_decompress(data, output, cbytes);
34
8.80k
    free(output);
35
8.80k
  }
36
8.80k
  return 0;
37
8.86k
}
38
39
#ifdef __cplusplus
40
}
41
#endif