/src/skcms/fuzz/fuzz_iccprofile_atf.c
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2018 Google Inc. |
3 | | * |
4 | | * Use of this source code is governed by a BSD-style license that can be |
5 | | * found in the LICENSE file. |
6 | | */ |
7 | | |
8 | | // This fuzz target parses an ICCProfile and then computes the |
9 | | // approximateTransferFunction. This is separate from fuzz_iccprofile_info |
10 | | // because it is a much more time-consuming function call. |
11 | | |
12 | | #include "../src/skcms_public.h" |
13 | | |
14 | | int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); |
15 | 3.28k | int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
16 | 3.28k | skcms_ICCProfile p; |
17 | 3.28k | if (!skcms_Parse(data, size, &p)) { |
18 | 2.71k | return 0; |
19 | 2.71k | } |
20 | | |
21 | 577 | skcms_TransferFunction tf; |
22 | 577 | float max_error; |
23 | 2.30k | for (int i = 0; i < 3; ++i) { |
24 | 1.73k | (void)skcms_ApproximateCurve(&p.trc[i], &tf, &max_error); |
25 | 1.73k | (void)max_error; |
26 | 1.73k | } |
27 | | |
28 | 577 | return 0; |
29 | 3.28k | } |