Coverage Report

Created: 2026-12-01 07:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libwrc/ossfuzz/version_information_resource_fuzzer.cc
Line
Count
Source
1
/*
2
 * OSS-Fuzz target for libwrc version_information_resource type
3
 *
4
 * Copyright (C) 2011-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_libwrc.h"
30
31
int LLVMFuzzerTestOneInput(
32
     const uint8_t *data,
33
     size_t size )
34
9.96k
{
35
9.96k
  libwrc_version_information_resource_t *version_information_resource = NULL;
36
9.96k
  uint64_t file_version                                               = 0;
37
9.96k
  uint64_t product_version                                            = 0;
38
39
9.96k
  if( libwrc_version_information_resource_initialize(
40
9.96k
       &version_information_resource,
41
9.96k
       NULL ) != 1 )
42
0
  {
43
0
    return( 0 );
44
0
  }
45
9.96k
  if( libwrc_version_information_resource_read(
46
9.96k
       version_information_resource,
47
9.96k
       data,
48
9.96k
       size,
49
9.96k
       NULL ) == 1 )
50
6.59k
  {
51
6.59k
    libwrc_version_information_resource_get_file_version(
52
6.59k
     version_information_resource,
53
6.59k
     &file_version,
54
6.59k
     NULL );
55
6.59k
    libwrc_version_information_resource_get_product_version(
56
6.59k
     version_information_resource,
57
6.59k
     &product_version,
58
6.59k
     NULL );
59
6.59k
  }
60
9.96k
  libwrc_version_information_resource_free(
61
9.96k
   &version_information_resource,
62
9.96k
   NULL );
63
64
9.96k
  return( 0 );
65
9.96k
}
66
67
} /* extern "C" */