Coverage Report

Created: 2026-07-16 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cms_postscript_fuzzer.c
Line
Count
Source
1
/* Copyright 2023 Google LLC
2
Licensed under the Apache License, Version 2.0 (the "License");
3
you may not use this file except in compliance with the License.
4
You may obtain a copy of the License at
5
      http://www.apache.org/licenses/LICENSE-2.0
6
Unless required by applicable law or agreed to in writing, software
7
distributed under the License is distributed on an "AS IS" BASIS,
8
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9
See the License for the specific language governing permissions and
10
limitations under the License.
11
*/
12
13
#include <stdint.h>
14
#include "lcms2.h"
15
16
7.08k
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
17
18
7.08k
    if (size < 16) {
19
6
        return 0;
20
6
    }
21
22
7.08k
    cmsContext context = cmsCreateContext(NULL, (void *)data);
23
7.08k
    if (!context){
24
0
        return 0;
25
0
    }
26
27
7.08k
    cmsHPROFILE hProfile = cmsOpenProfileFromMem(data, size);
28
7.08k
    if (!hProfile){
29
772
        cmsDeleteContext(context);
30
772
        return 0;
31
772
    }
32
33
6.30k
    uint32_t flags         = *((const uint32_t *)data+2);
34
6.30k
    uint32_t intent        = *((const uint32_t *)data+3) % 16;
35
36
    /* cmsGetPostScriptCSA */
37
6.30k
    cmsUInt32Number result1 = cmsGetPostScriptCSA(context, hProfile, intent, flags, NULL, size);
38
    /* cmsGetPostScriptCRD */
39
6.30k
    cmsUInt32Number result2 = cmsGetPostScriptCRD(context, hProfile, intent, flags,  NULL, size);
40
41
6.30k
    cmsCloseProfile(hProfile);
42
6.30k
    cmsDeleteContext(context);
43
44
6.30k
    return 0;
45
7.08k
}