Coverage Report

Created: 2026-09-12 06:55

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
229
{
20
229
    return 1;
21
229
}
22
23
int FuzzerTestOneInput(const uint8_t *data, size_t size)
24
2.52k
{
25
2.52k
    GENERAL_NAME *namesa;
26
2.52k
    GENERAL_NAME *namesb;
27
2.52k
    const unsigned char *derp = data;
28
29
2.52k
    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
2.52k
    namesa = d2i_GENERAL_NAME(NULL, &derp, (long)size);
37
2.52k
    derp = data;
38
2.52k
    namesb = d2i_GENERAL_NAME(NULL, &derp, (long)size);
39
2.52k
    if (namesa != NULL && namesb != NULL)
40
430
        GENERAL_NAME_cmp(namesa, namesb);
41
2.52k
    GENERAL_NAME_free(namesa);
42
2.52k
    GENERAL_NAME_free(namesb);
43
2.52k
    ERR_clear_error();
44
2.52k
    return 0;
45
2.52k
}
46
47
void FuzzerCleanup(void)
48
0
{
49
0
}