Coverage Report

Created: 2026-12-01 07:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libfmapi/ossfuzz/entry_identifier_fuzzer.cc
Line
Count
Source
1
/*
2
 * OSS-Fuzz target for libfmapi entry_identifier 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_libfmapi.h"
30
31
int LLVMFuzzerTestOneInput(
32
     const uint8_t *data,
33
     size_t size )
34
47
{
35
47
  char error_string[ 4096 ]          = { 0 };
36
37
47
  libfmapi_error_t *error            = NULL;
38
39
47
  libfmapi_entry_identifier_t *entry_identifier = NULL;
40
41
47
  uint8_t guid_data[ 16 ]            = { 0 };
42
43
47
  if( libfmapi_entry_identifier_initialize(
44
47
       &entry_identifier,
45
47
       &error ) == 1
46
47
   && libfmapi_entry_identifier_copy_from_byte_stream(
47
47
       entry_identifier,
48
47
       data,
49
47
       size,
50
47
       &error ) == 1 )
51
39
  {
52
39
    libfmapi_entry_identifier_get_service_provider_identifier(
53
39
     entry_identifier,
54
39
     guid_data,
55
39
     16,
56
39
     &error );
57
39
  }
58
47
  libfmapi_entry_identifier_free(
59
47
   &entry_identifier,
60
47
   &error );
61
62
47
  if( error != NULL )
63
8
  {
64
8
    libfmapi_error_sprint(
65
8
     error,
66
8
     error_string,
67
8
     sizeof( error_string ) );
68
69
8
    libfmapi_error_backtrace_sprint(
70
8
     error,
71
8
     error_string,
72
8
     sizeof( error_string ) );
73
8
  }
74
47
  libfmapi_error_free(
75
47
   &error );
76
77
47
  return( 0 );
78
47
}
79
80
} /* extern "C" */