Coverage Report

Created: 2025-10-26 07:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/vulnerable.cc
Line
Count
Source
1
// Copyright 2023 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <stdint.h>
16
#include <stdlib.h>
17
#include <stddef.h>
18
192
extern "C" int LLVMFuzzerTestOneInput(uint8_t* data, size_t size) {
19
192
  if (size < 4) {
20
2
    return 0;
21
2
  }
22
23
190
  int index = 0;
24
190
  if (data[index++] != 'H')
25
16
    return 0;
26
27
174
  if (data[index++] != 'e')
28
14
    return 0;
29
30
160
  if (data[index++] != 'l')
31
15
    return 0;
32
33
145
  if (size < 13) {
34
6
    return 0;
35
6
  }
36
139
  if (data[index++] != 'l')
37
16
    return 0;
38
123
  if (data[index++] != 'o')
39
22
    return 0;
40
101
  if (data[index++] != ',')
41
16
    return 0;
42
85
  if (data[index++] != ' ')
43
10
    return 0;
44
75
  if (data[index++] != 'W')
45
11
    return 0;
46
64
  if (data[index++] != 'o')
47
11
    return 0;
48
53
  if (data[index++] != 'r')
49
13
    return 0;
50
40
  if (data[index++] != 'l')
51
12
    return 0;
52
28
  if (data[index++] != 'd')
53
15
    return 0;
54
13
  if (data[index] != '!')
55
13
    return 0;
56
57
0
  uint8_t* x = (uint8_t *) malloc(10);
58
0
  free(x);
59
60
0
  return x[8];
61
13
}