grpc
third_party
boringssl-with-bazel
src
fuzz
read_pem.cc
Go to the documentation of this file.
1
/* Copyright (c) 2016, Google Inc.
2
*
3
* Permission to use, copy, modify, and/or distribute this software for any
4
* purpose with or without fee is hereby granted, provided that the above
5
* copyright notice and this permission notice appear in all copies.
6
*
7
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15
#include <
openssl/bio.h
>
16
#include <
openssl/err.h
>
17
#include <
openssl/mem.h
>
18
#include <
openssl/pem.h
>
19
20
21
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
buf
,
size_t
len
) {
22
char
*
name
, *
header
;
23
uint8_t
*pem_data;
24
long
pem_len;
25
26
BIO
*bio =
BIO_new_mem_buf
(
buf
,
len
);
27
28
if
(
PEM_read_bio
(bio, &
name
, &
header
, &pem_data, &pem_len) == 1) {
29
OPENSSL_free
(
name
);
30
OPENSSL_free
(
header
);
31
OPENSSL_free
(pem_data);
32
}
33
34
BIO_free
(bio);
35
36
ERR_clear_error
();
37
return
0;
38
}
LLVMFuzzerTestOneInput
int LLVMFuzzerTestOneInput(const uint8_t *buf, size_t len)
Definition:
read_pem.cc:21
bio_st
Definition:
bio.h:822
bio.h
buf
voidpf void * buf
Definition:
bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
pem.h
setup.name
name
Definition:
setup.py:542
PEM_read_bio
#define PEM_read_bio
Definition:
boringssl_prefix_symbols.h:1940
uint8_t
unsigned char uint8_t
Definition:
stdint-msvc2008.h:78
BIO_new_mem_buf
#define BIO_new_mem_buf
Definition:
boringssl_prefix_symbols.h:820
header
struct absl::base_internal::@2940::AllocList::Header header
err.h
BIO_free
#define BIO_free
Definition:
boringssl_prefix_symbols.h:787
ERR_clear_error
#define ERR_clear_error
Definition:
boringssl_prefix_symbols.h:1413
mem.h
len
int len
Definition:
abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
OPENSSL_free
#define OPENSSL_free
Definition:
boringssl_prefix_symbols.h:1869
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:00