Coverage Report

Created: 2026-10-28 06:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/openssl41/fuzz/v3name.c
Line
Count
Source
1
/*
2
 * Copyright 2012-2026 The OpenSSL Project Authors. All Rights Reserved.
3
 *
4
 * Licensed under the Apache License 2.0 (the "License").  You may not use
5
 * this file except in compliance with the License.  You can obtain a copy
6
 * in the file LICENSE in the source distribution or at
7
 * https://www.openssl.org/source/license.html
8
 */
9
10
#include <string.h>
11
#include <openssl/e_os2.h>
12
#include <openssl/err.h>
13
#include <openssl/x509.h>
14
#include <openssl/x509v3.h>
15
#include "internal/nelem.h"
16
#include "fuzzer.h"
17
18
int FuzzerInitialize(int *argc, char ***argv)
19
254
{
20
254
    return 1;
21
254
}
22
23
int FuzzerTestOneInput(const uint8_t *data, size_t size)
24
5.28k
{
25
5.28k
    GENERAL_NAME *namesa;
26
5.28k
    GENERAL_NAME *namesb;
27
5.28k
    const unsigned char *derp = data;
28
29
5.28k
    if (size > LONG_MAX)
30
0
        return 0;
31
32
    /*
33
     * We create two versions of each GENERAL_NAME so that we ensure when
34
     * we compare them they are always different pointers.
35
     */
36
5.28k
    namesa = d2i_GENERAL_NAME(NULL, &derp, (long)size);
37
5.28k
    derp = data;
38
5.28k
    namesb = d2i_GENERAL_NAME(NULL, &derp, (long)size);
39
5.28k
    if (namesa != NULL && namesb != NULL)
40
891
        GENERAL_NAME_cmp(namesa, namesb);
41
5.28k
    GENERAL_NAME_free(namesa);
42
5.28k
    GENERAL_NAME_free(namesb);
43
5.28k
    ERR_clear_error();
44
5.28k
    return 0;
45
5.28k
}
46
47
void FuzzerCleanup(void)
48
0
{
49
0
}