Coverage Report

Created: 2025-08-26 06:04

/src/rauc/fuzz/fuzz.h
Line
Count
Source
1
/*
2
 * Copyright 2018 pdknsk
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
#include <gio/gio.h>
21
#include <glib.h>
22
23
int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
24
25
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
26
static GLogWriterOutput
27
empty_logging_func(GLogLevelFlags log_level, const GLogField *fields,
28
    gsize n_fields, gpointer user_data)
29
22.4k
{
30
22.4k
  return G_LOG_WRITER_HANDLED;
31
22.4k
}
Unexecuted instantiation: manifest.c:empty_logging_func
bundle.c:empty_logging_func
Line
Count
Source
29
22.4k
{
30
22.4k
  return G_LOG_WRITER_HANDLED;
31
22.4k
}
32
#endif
33
34
/* Disables logging for oss-fuzz. Must be used with each target. */
35
static void
36
fuzz_set_logging_func(void)
37
7.81k
{
38
7.81k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
39
7.81k
  static gboolean writer_set = FALSE;
40
41
7.81k
  if (!writer_set) {
42
2
    g_log_set_writer_func(empty_logging_func, NULL, NULL);
43
2
    writer_set = TRUE;
44
2
  }
45
7.81k
#endif
46
7.81k
}
manifest.c:fuzz_set_logging_func
Line
Count
Source
37
2.88k
{
38
2.88k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
39
2.88k
  static gboolean writer_set = FALSE;
40
41
2.88k
  if (!writer_set) {
42
1
    g_log_set_writer_func(empty_logging_func, NULL, NULL);
43
1
    writer_set = TRUE;
44
1
  }
45
2.88k
#endif
46
2.88k
}
bundle.c:fuzz_set_logging_func
Line
Count
Source
37
4.92k
{
38
4.92k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
39
4.92k
  static gboolean writer_set = FALSE;
40
41
4.92k
  if (!writer_set) {
42
1
    g_log_set_writer_func(empty_logging_func, NULL, NULL);
43
1
    writer_set = TRUE;
44
1
  }
45
4.92k
#endif
46
4.92k
}