Coverage Report

Created: 2026-12-01 07:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libfvde/ossfuzz/compression_fuzzer.cc
Line
Count
Source
1
/*
2
 * OSS-Fuzz target for libfvde compression type
3
 *
4
 * Copyright (C) 2026, Joachim Metz <joachim.metz@gmail.com>
5
 *
6
 * Refer to AUTHORS for acknowledgements.
7
 *
8
 * This program is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Lesser General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
 */
21
22
#include <stddef.h>
23
#include <stdint.h>
24
25
/* Note that some of the OSS-Fuzz engines use C++
26
 */
27
extern "C" {
28
29
#include "ossfuzz_libbfio.h"
30
#include "ossfuzz_libfvde.h"
31
32
#include "../libfvde/libfvde_compression.h"
33
#include "../libfvde/libfvde_definitions.h"
34
35
int LLVMFuzzerTestOneInput(
36
     const uint8_t *data,
37
     size_t size )
38
8.90k
{
39
8.90k
  uint8_t uncompressed_data[ 64 * 1024 ];
40
41
8.90k
  size_t uncompressed_data_size = sizeof( uncompressed_data );
42
43
8.90k
  libfvde_decompress_data(
44
8.90k
   data,
45
8.90k
   size,
46
8.90k
   LIBFVDE_COMPRESSION_METHOD_DEFLATE,
47
8.90k
   uncompressed_data,
48
8.90k
   &uncompressed_data_size,
49
8.90k
   NULL );
50
51
8.90k
  uncompressed_data_size = sizeof( uncompressed_data );
52
53
8.90k
  libfvde_decompress_data(
54
8.90k
   data,
55
8.90k
   size,
56
8.90k
   LIBFVDE_COMPRESSION_METHOD_NONE,
57
8.90k
   uncompressed_data,
58
8.90k
   &uncompressed_data_size,
59
   NULL );
60
8.90k
  return( 0 );
61
8.90k
}
62
63
} /* extern "C" */