Coverage Report

Created: 2026-04-01 06:06

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/glib/fuzzing/fuzz_uri_parse_params.c
Line
Count
Source
1
/*
2
 * Copyright 2020 Endless OS Foundation, LLC
3
 * Copyright 2020 Red Hat, Inc.
4
 *
5
 * SPDX-License-Identifier: LGPL-2.1-or-later
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#include "fuzz.h"
22
23
int
24
LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
25
1.29k
{
26
1.29k
  GError *error = NULL;
27
1.29k
  GHashTable *parsed_params = NULL;
28
29
1.29k
  fuzz_set_logging_func ();
30
31
1.29k
  if (size > G_MAXSSIZE)
32
0
    return 0;
33
34
1.29k
  parsed_params = g_uri_parse_params ((const gchar *) data, (gssize) size,
35
1.29k
                                      "&", G_URI_PARAMS_NONE, &error);
36
1.29k
  if (parsed_params == NULL)
37
510
    {
38
510
      g_assert (error);
39
510
      g_clear_error (&error);
40
510
      return 0;
41
510
    }
42
43
44
1.29k
  g_assert_no_error (error);
45
782
  g_hash_table_unref (parsed_params);
46
47
782
  return 0;
48
1.29k
}