Make sure grpc_secure_channel_create() never returns NULL.

pull/9539/head
Mark D. Roth 8 years ago
parent bcfc085e78
commit b43c7bfb85
  1. 5
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
  2. 1
      test/core/end2end/fuzzers/api_fuzzer.c

@ -144,5 +144,8 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
"secure_client_channel_factory_create_channel");
grpc_channel_args_destroy(&exec_ctx, new_args);
grpc_exec_ctx_finish(&exec_ctx);
return channel; /* may be NULL */
return channel == NULL ? channel
: grpc_lame_client_channel_create(
target, GRPC_STATUS_INTERNAL,
"Failed to create secure client channel");
}

@ -1155,6 +1155,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_channel_args *args = read_args(&inp);
grpc_channel_credentials *creds = read_channel_creds(&inp);
g_channel = grpc_secure_channel_create(creds, target_uri, args, NULL);
GPR_ASSERT(g_channel != NULL);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, args);

Loading…
Cancel
Save