/src/h3/src/apps/fuzzers/fuzzerResolutions.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 resolution specific functions |
18 | | */ |
19 | | |
20 | | #include "aflHarness.h" |
21 | | #include "h3api.h" |
22 | | #include "utility.h" |
23 | | |
24 | | typedef struct { |
25 | | int res; |
26 | | } inputArgs; |
27 | | |
28 | 2.35k | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
29 | 2.35k | if (size < sizeof(inputArgs)) { |
30 | 60 | return 0; |
31 | 60 | } |
32 | 2.29k | const inputArgs *args = (const inputArgs *)data; |
33 | | |
34 | 2.29k | double out; |
35 | 2.29k | H3_EXPORT(getHexagonAreaAvgKm2)(args->res, &out); |
36 | 2.29k | H3_EXPORT(getHexagonAreaAvgM2)(args->res, &out); |
37 | 2.29k | H3_EXPORT(getHexagonEdgeLengthAvgKm)(args->res, &out); |
38 | 2.29k | H3_EXPORT(getHexagonEdgeLengthAvgM)(args->res, &out); |
39 | | |
40 | 2.29k | int64_t outInt; |
41 | 2.29k | H3_EXPORT(getNumCells)(args->res, &outInt); |
42 | | |
43 | 2.29k | H3Index pentagons[12]; |
44 | 2.29k | H3_EXPORT(getPentagons)(args->res, pentagons); |
45 | | |
46 | 2.29k | return 0; |
47 | 2.35k | } |
48 | | |
49 | | AFL_HARNESS_MAIN(sizeof(inputArgs)); |