Coverage Report

Created: 2026-09-28 07:36

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/fluent-bit/tests/internal/fuzzers/cmetrics_decode_prometheus.c
Line
Count
Source
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3
/*  Fluent Bit
4
 *  ==========
5
 *  Copyright (C) 2015-2023 The Fluent Bit Authors
6
 *
7
 *  Licensed under the Apache License, Version 2.0 (the "License");
8
 *  you may not use this file except in compliance with the License.
9
 *  You may obtain a copy of the License at
10
 *
11
 *      http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 *  Unless required by applicable law or agreed to in writing, software
14
 *  distributed under the License is distributed on an "AS IS" BASIS,
15
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 *  See the License for the specific language governing permissions and
17
 *  limitations under the License.
18
 */
19
20
#include <cmetrics/cmt_decode_prometheus.h>
21
22
23
int
24
LLVMFuzzerTestOneInput(const uint8_t * data, size_t size)
25
1.78k
{
26
1.78k
    struct cmt *cmt = NULL;
27
1.78k
    int result;
28
29
    /* At least one byte is needed for deciding which decoder to use */
30
1.78k
    if (size < 1) {
31
0
        return 0;
32
0
    }
33
34
1.78k
    struct cmt_decode_prometheus_parse_opts opts;
35
1.78k
    result = cmt_decode_prometheus_create(&cmt, data, size, &opts);
36
1.78k
    if (result == CMT_DECODE_PROMETHEUS_SUCCESS) {
37
0
        cmt_decode_prometheus_destroy(cmt);
38
0
    }
39
40
1.78k
    return 0;
41
1.78k
}