Coverage Report

Created: 2026-10-17 07:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tinysparql/fuzzing/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
#include <sqlite3.h>
23
#include "tinysparql.h"
24
25
int LLVMFuzzerTestOneInput (const unsigned char *data, size_t size);
26
27
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
28
static GLogWriterOutput
29
empty_logging_func (GLogLevelFlags log_level, const GLogField *fields,
30
                    gsize n_fields, gpointer user_data)
31
419k
{
32
419k
  return G_LOG_WRITER_HANDLED;
33
419k
}
fuzz_query.c:empty_logging_func
Line
Count
Source
31
2
{
32
2
  return G_LOG_WRITER_HANDLED;
33
2
}
fuzz_rdf_jsonld.c:empty_logging_func
Line
Count
Source
31
400k
{
32
400k
  return G_LOG_WRITER_HANDLED;
33
400k
}
fuzz_ontology_turtle.c:empty_logging_func
Line
Count
Source
31
10.0k
{
32
10.0k
  return G_LOG_WRITER_HANDLED;
33
10.0k
}
fuzz_rdf_trig.c:empty_logging_func
Line
Count
Source
31
4.45k
{
32
4.45k
  return G_LOG_WRITER_HANDLED;
33
4.45k
}
fuzz_rdf_turtle.c:empty_logging_func
Line
Count
Source
31
4.93k
{
32
4.93k
  return G_LOG_WRITER_HANDLED;
33
4.93k
}
34
#endif
35
36
/* Disables logging for oss-fuzz. Must be used with each target. */
37
static void
38
fuzz_set_logging_func (void)
39
43.2k
{
40
43.2k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
43.2k
  static gboolean writer_set = FALSE;
42
43
43.2k
  if (!writer_set) {
44
5
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
5
    writer_set = TRUE;
46
5
  }
47
43.2k
#endif
48
43.2k
}
fuzz_query.c:fuzz_set_logging_func
Line
Count
Source
39
6.01k
{
40
6.01k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
6.01k
  static gboolean writer_set = FALSE;
42
43
6.01k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
6.01k
#endif
48
6.01k
}
fuzz_rdf_jsonld.c:fuzz_set_logging_func
Line
Count
Source
39
10.9k
{
40
10.9k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
10.9k
  static gboolean writer_set = FALSE;
42
43
10.9k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
10.9k
#endif
48
10.9k
}
fuzz_ontology_turtle.c:fuzz_set_logging_func
Line
Count
Source
39
9.79k
{
40
9.79k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
9.79k
  static gboolean writer_set = FALSE;
42
43
9.79k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
9.79k
#endif
48
9.79k
}
fuzz_rdf_trig.c:fuzz_set_logging_func
Line
Count
Source
39
7.54k
{
40
7.54k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
7.54k
  static gboolean writer_set = FALSE;
42
43
7.54k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
7.54k
#endif
48
7.54k
}
fuzz_rdf_turtle.c:fuzz_set_logging_func
Line
Count
Source
39
8.97k
{
40
8.97k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
8.97k
  static gboolean writer_set = FALSE;
42
43
8.97k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
8.97k
#endif
48
8.97k
}