Coverage Report

Created: 2025-07-23 06:43

/src/gnutls/fuzz/gnutls_ext_raw_parse_fuzzer.c
Line
Count
Source
1
/*
2
 * Copyright (C) 2019 Red Hat, Inc.
3
 *
4
 * Author: Nikos Mavrogiannopoulos
5
 *
6
 * This file is part of GnuTLS.
7
 *
8
 * The GnuTLS is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public License
10
 * as published by the Free Software Foundation; either version 2.1 of
11
 * the License, or (at your option) any later version.
12
 *
13
 * This library is distributed in the hope that it will be useful, but
14
 * WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 * Lesser General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Lesser General Public License
19
 * along with this program.  If not, see <https://www.gnu.org/licenses/>
20
 *
21
 */
22
23
#include <stdint.h>
24
25
#include <gnutls/gnutls.h>
26
27
#include "fuzzer.h"
28
29
static int cb(void *ctx, unsigned tls_id, const unsigned char *data,
30
        unsigned data_size)
31
21.2k
{
32
21.2k
  return 0;
33
21.2k
}
34
35
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
36
608
{
37
608
  gnutls_datum_t raw;
38
39
608
  raw.data = (unsigned char *)data;
40
608
  raw.size = size;
41
42
608
  gnutls_ext_raw_parse(NULL, cb, &raw, 0);
43
44
608
  gnutls_ext_raw_parse(NULL, cb, &raw,
45
608
           GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO);
46
47
608
  gnutls_ext_raw_parse(NULL, cb, &raw,
48
608
           GNUTLS_EXT_RAW_FLAG_DTLS_CLIENT_HELLO);
49
50
608
  return 0;
51
608
}