Coverage Report

Created: 2025-06-13 06:58

/src/openssl32/fuzz/v3name.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2012-2023 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/x509.h>
13
#include <openssl/x509v3.h>
14
#include "internal/nelem.h"
15
#include "fuzzer.h"
16
17
int FuzzerInitialize(int *argc, char ***argv)
18
108
{
19
108
    return 1;
20
108
}
21
22
5.29k
int FuzzerTestOneInput(const uint8_t* data, size_t size){
23
5.29k
    GENERAL_NAME *namesa;
24
5.29k
    GENERAL_NAME *namesb;
25
26
5.29k
    const unsigned char *derp = data;
27
    /*
28
     * We create two versions of each GENERAL_NAME so that we ensure when
29
     * we compare them they are always different pointers.
30
     */
31
5.29k
    namesa = d2i_GENERAL_NAME(NULL, &derp, size);
32
5.29k
    derp = data;
33
5.29k
    namesb = d2i_GENERAL_NAME(NULL, &derp, size);
34
5.29k
    GENERAL_NAME_cmp(namesa, namesb);
35
5.29k
    if (namesa != NULL)
36
937
        GENERAL_NAME_free(namesa);
37
5.29k
    if (namesb != NULL)
38
937
        GENERAL_NAME_free(namesb);
39
5.29k
    return 0;
40
5.29k
}
41
42
void FuzzerCleanup(void)
43
0
{
44
0
}