Coverage Report

Created: 2025-11-16 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wget2/fuzz/libwget_atom_url_fuzzer.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2017-2024 Free Software Foundation, Inc.
3
 *
4
 * This file is part of libwget.
5
 *
6
 * Libwget is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * Libwget 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
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with libwget.  If not, see <https://www.gnu.org/licenses/>.
18
 */
19
20
#include <config.h>
21
22
#include <assert.h>
23
#include <stdio.h>
24
#include <stdint.h>
25
#include <stdlib.h>
26
#include <string.h>
27
28
#include "wget.h"
29
#include "fuzzer.h"
30
31
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
32
19.1k
{
33
19.1k
  if (size > 10000) // same as max_len = 10000 in .options file
34
40
    return 0;
35
36
19.0k
  char *in = (char *) malloc(size + 1);
37
38
19.0k
  assert(in != NULL);
39
40
  // 0 terminate
41
19.0k
  memcpy(in, data, size);
42
19.0k
  in[size] = 0;
43
44
19.0k
  wget_vector *urls;
45
19.0k
  wget_atom_get_urls_inline(in, &urls);
46
19.0k
  wget_vector_free(&urls);
47
19.0k
  wget_rss_get_urls_inline(in, &urls);
48
19.0k
  wget_vector_free(&urls);
49
50
19.0k
  free(in);
51
52
19.0k
  return 0;
53
19.0k
}