Coverage Report

Created: 2026-12-01 07:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libfwnt/ossfuzz/security_identifier_fuzzer.cc
Line
Count
Source
1
/*
2
 * OSS-Fuzz target for libfwnt security identifier type
3
 *
4
 * Copyright (C) 2009-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_libfwnt.h"
30
31
int LLVMFuzzerTestOneInput(
32
     const uint8_t *data,
33
     size_t size )
34
604
{
35
604
  uint8_t utf8_string[ 128 ];
36
604
  uint16_t utf16_string[ 128 ];
37
604
  uint32_t utf32_string[ 128 ];
38
39
604
  libfwnt_security_identifier_t *security_identifier = NULL;
40
604
  size_t string_size                                 = 0;
41
604
  size_t utf8_string_index                           = 0;
42
604
  size_t utf16_string_index                          = 0;
43
604
  size_t utf32_string_index                          = 0;
44
45
604
  if( libfwnt_security_identifier_initialize(
46
604
       &security_identifier,
47
604
       NULL ) != 1 )
48
0
  {
49
0
    return( 0 );
50
0
  }
51
604
  libfwnt_security_identifier_copy_from_byte_stream(
52
604
   security_identifier,
53
604
   data,
54
604
   size,
55
604
   LIBFWNT_ENDIAN_BIG,
56
604
   NULL );
57
58
604
  libfwnt_security_identifier_copy_from_byte_stream(
59
604
   security_identifier,
60
604
   data,
61
604
   size,
62
604
   LIBFWNT_ENDIAN_LITTLE,
63
604
   NULL );
64
65
604
  libfwnt_security_identifier_get_string_size(
66
604
   security_identifier,
67
604
   &string_size,
68
604
   0,
69
604
   NULL );
70
71
604
  libfwnt_security_identifier_copy_to_utf8_string(
72
604
   security_identifier,
73
604
   utf8_string,
74
604
   128,
75
604
   0,
76
604
   NULL );
77
78
604
  libfwnt_security_identifier_copy_to_utf8_string_with_index(
79
604
   security_identifier,
80
604
   utf8_string,
81
604
   128,
82
604
   &utf8_string_index,
83
604
   0,
84
604
   NULL );
85
86
604
  libfwnt_security_identifier_copy_to_utf16_string(
87
604
   security_identifier,
88
604
   utf16_string,
89
604
   128,
90
604
   0,
91
604
   NULL );
92
93
604
  libfwnt_security_identifier_copy_to_utf16_string_with_index(
94
604
   security_identifier,
95
604
   utf16_string,
96
604
   128,
97
604
   &utf16_string_index,
98
604
   0,
99
604
   NULL );
100
101
604
  libfwnt_security_identifier_copy_to_utf32_string(
102
604
   security_identifier,
103
604
   utf32_string,
104
604
   128,
105
604
   0,
106
604
   NULL );
107
108
604
  libfwnt_security_identifier_copy_to_utf32_string_with_index(
109
604
   security_identifier,
110
604
   utf32_string,
111
604
   128,
112
604
   &utf32_string_index,
113
604
   0,
114
604
   NULL );
115
116
604
  libfwnt_security_identifier_free(
117
604
   &security_identifier,
118
604
   NULL );
119
120
604
  return( 0 );
121
604
}
122
123
} /* extern "C" */