Coverage Report

Created: 2026-02-09 06:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gnutls/fuzz/gnutls_base64_decoder_fuzzer.c
Line
Count
Source
1
/*
2
# Copyright 2017 Red Hat, Inc.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#      https://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
#
16
################################################################################
17
*/
18
19
#include <stdint.h>
20
21
#include <gnutls/gnutls.h>
22
#include "fuzzer.h"
23
24
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
25
478
{
26
478
  gnutls_datum_t raw = { .data = (unsigned char *)data, .size = size };
27
478
  gnutls_datum_t out;
28
478
  unsigned char result[50];
29
478
  size_t result_size = sizeof(result);
30
478
  int ret;
31
32
478
  ret = gnutls_pem_base64_decode2(NULL, &raw, &out);
33
478
  if (ret >= 0)
34
242
    gnutls_free(out.data);
35
36
478
  gnutls_pem_base64_decode(NULL, &raw, result, &result_size);
37
38
478
  ret = gnutls_base64_decode2(&raw, &out);
39
478
  if (ret >= 0)
40
219
    gnutls_free(out.data);
41
42
478
  return 0;
43
478
}