|
|
|
@ -55,6 +55,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
|
|
|
|
if (squelch) gpr_set_log_function(dont_log); |
|
|
|
|
if (leak_check) grpc_memory_counters_init(); |
|
|
|
|
grpc_init(); |
|
|
|
|
{ |
|
|
|
|
grpc_core::ExecCtx _local_exec_ctx; |
|
|
|
|
|
|
|
|
|
grpc_resource_quota* resource_quota = |
|
|
|
@ -73,8 +74,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
|
|
|
|
cert_slice = grpc_slice_from_static_string(test_server1_cert); |
|
|
|
|
key_slice = grpc_slice_from_static_string(test_server1_key); |
|
|
|
|
const char* ca_cert = (const char*)GRPC_SLICE_START_PTR(ca_slice); |
|
|
|
|
pem_key_cert_pair.private_key = (const char*)GRPC_SLICE_START_PTR(key_slice); |
|
|
|
|
pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice); |
|
|
|
|
pem_key_cert_pair.private_key = |
|
|
|
|
(const char*)GRPC_SLICE_START_PTR(key_slice); |
|
|
|
|
pem_key_cert_pair.cert_chain = |
|
|
|
|
(const char*)GRPC_SLICE_START_PTR(cert_slice); |
|
|
|
|
grpc_server_credentials* creds = grpc_ssl_server_credentials_create( |
|
|
|
|
ca_cert, &pem_key_cert_pair, 1, 0, nullptr); |
|
|
|
|
|
|
|
|
@ -95,11 +98,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
|
|
|
|
grpc_core::ExecCtx::Get()->Flush(); |
|
|
|
|
|
|
|
|
|
// If the given string happens to be part of the correct client hello, the
|
|
|
|
|
// server will wait for more data. Explicitly fail the server by shutting down
|
|
|
|
|
// the endpoint.
|
|
|
|
|
// server will wait for more data. Explicitly fail the server by shutting
|
|
|
|
|
// down the endpoint.
|
|
|
|
|
if (!state.done_callback_called) { |
|
|
|
|
grpc_endpoint_shutdown( |
|
|
|
|
mock_endpoint, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close")); |
|
|
|
|
mock_endpoint, |
|
|
|
|
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Explicit close")); |
|
|
|
|
grpc_core::ExecCtx::Get()->Flush(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -112,6 +116,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
|
|
|
|
grpc_slice_unref(key_slice); |
|
|
|
|
grpc_slice_unref(ca_slice); |
|
|
|
|
grpc_core::ExecCtx::Get()->Flush(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_shutdown(); |
|
|
|
|
if (leak_check) { |
|
|
|
|