Coverage Report

Created: 2026-09-29 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pacemaker/lib/common/fuzzers/strings_fuzzer.c
Line
Count
Source
1
/*
2
 * Copyright 2024-2026 the Pacemaker project contributors
3
 *
4
 * The version control history for this file may have further details.
5
 *
6
 * This source code is licensed under the GNU Lesser General Public License
7
 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8
 */
9
10
#include <crm_internal.h>
11
12
#include <stdint.h>
13
#include <stdlib.h>
14
#include <stdio.h>
15
#include <strings.h>
16
#include <glib.h>
17
18
#include <crm/common/options.h>
19
#include <crm/common/util.h>
20
21
int
22
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
23
1.44k
{
24
1.44k
    char *ns = NULL;
25
1.44k
    unsigned int res = 0;
26
1.44k
    long long msec = 0LL;
27
28
1.44k
    if (size < 10) {
29
16
        return -1; // Do not add input to testing corpus
30
16
    }
31
1.42k
    ns = pcmk__assert_alloc(size + 1, sizeof(char));
32
1.42k
    memcpy(ns, data, size);
33
1.42k
    ns[size] = '\0';
34
35
1.42k
    pcmk__numeric_strcasecmp(ns, ns);
36
1.42k
    pcmk_parse_interval_spec(ns, &res);
37
1.42k
    pcmk__parse_ms(ns, &msec);
38
39
1.42k
    free(ns);
40
1.42k
    return 0;
41
1.44k
}