Coverage Report

Created: 2025-12-10 06:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/h3/src/apps/fuzzers/fuzzerVertexes.c
Line
Count
Source
1
/*
2
 * Copyright 2021 Uber Technologies, Inc.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *         http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
/** @file
17
 * @brief Fuzzer program for cellToVertex and related functions
18
 */
19
20
#include "aflHarness.h"
21
#include "h3api.h"
22
#include "utility.h"
23
24
typedef struct {
25
    H3Index index;
26
    int vertexNum;
27
} inputArgs;
28
29
431
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
30
431
    if (size < sizeof(inputArgs)) {
31
6
        return 0;
32
6
    }
33
425
    const inputArgs *args = (const inputArgs *)data;
34
35
425
    H3Index out;
36
425
    H3_EXPORT(cellToVertex)(args->index, args->vertexNum, &out);
37
425
    H3Index outArr[6];
38
425
    H3_EXPORT(cellToVertexes)(args->index, outArr);
39
425
    LatLng geo;
40
425
    H3_EXPORT(vertexToLatLng)(args->index, &geo);
41
425
    H3_EXPORT(isValidVertex)(args->index);
42
425
    return 0;
43
431
}
44
45
AFL_HARNESS_MAIN(sizeof(inputArgs));