Coverage Report

Created: 2026-08-31 06:46

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
364k
{
32
364k
  return G_LOG_WRITER_HANDLED;
33
364k
}
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
343k
{
32
343k
  return G_LOG_WRITER_HANDLED;
33
343k
}
fuzz_ontology_turtle.c:empty_logging_func
Line
Count
Source
31
9.82k
{
32
9.82k
  return G_LOG_WRITER_HANDLED;
33
9.82k
}
fuzz_rdf_trig.c:empty_logging_func
Line
Count
Source
31
4.69k
{
32
4.69k
  return G_LOG_WRITER_HANDLED;
33
4.69k
}
fuzz_rdf_turtle.c:empty_logging_func
Line
Count
Source
31
6.61k
{
32
6.61k
  return G_LOG_WRITER_HANDLED;
33
6.61k
}
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
40.9k
{
40
40.9k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
40.9k
  static gboolean writer_set = FALSE;
42
43
40.9k
  if (!writer_set) {
44
5
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
5
    writer_set = TRUE;
46
5
  }
47
40.9k
#endif
48
40.9k
}
fuzz_query.c:fuzz_set_logging_func
Line
Count
Source
39
6.00k
{
40
6.00k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
6.00k
  static gboolean writer_set = FALSE;
42
43
6.00k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
6.00k
#endif
48
6.00k
}
fuzz_rdf_jsonld.c:fuzz_set_logging_func
Line
Count
Source
39
9.36k
{
40
9.36k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
9.36k
  static gboolean writer_set = FALSE;
42
43
9.36k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
9.36k
#endif
48
9.36k
}
fuzz_ontology_turtle.c:fuzz_set_logging_func
Line
Count
Source
39
10.0k
{
40
10.0k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
10.0k
  static gboolean writer_set = FALSE;
42
43
10.0k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
10.0k
#endif
48
10.0k
}
fuzz_rdf_trig.c:fuzz_set_logging_func
Line
Count
Source
39
7.48k
{
40
7.48k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
7.48k
  static gboolean writer_set = FALSE;
42
43
7.48k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
7.48k
#endif
48
7.48k
}
fuzz_rdf_turtle.c:fuzz_set_logging_func
Line
Count
Source
39
8.11k
{
40
8.11k
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
41
8.11k
  static gboolean writer_set = FALSE;
42
43
8.11k
  if (!writer_set) {
44
1
    g_log_set_writer_func (empty_logging_func, NULL, NULL);
45
1
    writer_set = TRUE;
46
1
  }
47
8.11k
#endif
48
8.11k
}