Coverage Report

Created: 2026-05-16 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/p11-kit/fuzz/conf_fuzzer.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2026, David Korczynski.
3
 *
4
 * All rights reserved.
5
 *
6
 * Redistribution and use in source and binary forms, with or without
7
 * modification, are permitted provided that the following conditions
8
 * are met:
9
 *
10
 *     * Redistributions of source code must retain the above
11
 *       copyright notice, this list of conditions and the
12
 *       following disclaimer.
13
 *     * Redistributions in binary form must reproduce the
14
 *       above copyright notice, this list of conditions and
15
 *       the following disclaimer in the documentation and/or
16
 *       other materials provided with the distribution.
17
 *     * The names of contributors to this software may not be
18
 *       used to endorse or promote products derived from this
19
 *       software without specific prior written permission.
20
 *
21
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
31
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32
 * DAMAGE.
33
 *
34
 */
35
36
37
#include "config.h"
38
#include "test.h"
39
40
#include "fuzz/fuzz.h"
41
#include "lexer.h"
42
43
#include <stdlib.h>
44
#include <string.h>
45
46
#ifdef __cplusplus
47
extern "C"
48
#endif
49
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
50
438
{
51
438
    p11_lexer lexer;
52
438
    bool failed;
53
54
438
    p11_lexer_init(&lexer, "fuzz-input", (const char *)data, size);
55
56
6.51k
    while (p11_lexer_next(&lexer, &failed)) {
57
        /* Just consume all tokens to exercise the lexer.
58
         * The token data (section names, field name/value pairs,
59
         * PEM blocks) is accessible via lexer.tok but we don't
60
         * need to do anything with it — the parsing itself is
61
         * what we're testing for memory safety. */
62
6.07k
    }
63
64
438
    p11_lexer_done(&lexer);
65
66
438
    return 0;
67
438
}