Expand corpus, add call creds

pull/8586/head
Craig Tiller 8 years ago
parent 28fb56f4cc
commit 775e5b9861
  1. 96
      test/core/end2end/fuzzers/api_fuzzer.c
  2. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/0e5aa755fff40b487617e01f6812d85ad310b727
  3. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/13b2e7a9d9f07a9e06ed96957c56e968f3b6070d
  4. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/16b69b968a140abb00dd5c79ea7d0c1b23510fe7
  5. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/17c7024889cc97a8afd3133b55a147ba75d17188
  6. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/35b84f9f429e72230f0e9f6400ae5052c961fb27
  7. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/43d52b36766d71176a2fc9f2a4be385bd2638570
  8. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/467971d589278cc348786054add9f1efda2fef9e
  9. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/4b538eda0a7ad5d38b9d95867b7c181cbe84589b
  10. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/4e4e5902e6d79c5d57bbf631863ab51b8b07943a
  11. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/58f87cac2d3f564f1afe4ca85637e47b758796a5
  12. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/5bcde4a99b8ad54a5b8ba9b5131842c6c7c0ef19
  13. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/5fe822a742cf2f5328cec86c0972b0c7b4bd4460
  14. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/6cb9930369caf7584015d3a17c37e144d23b79ce
  15. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/7b747e0fabbfae7ecb4e9e8261121aaa42a21cc2
  16. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/83b2491b16c26c0dbb6aef5a9df10a3fa83beea2
  17. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/8d1242821c2d5fc81c8e0b397d91cf75cb1b5f2c
  18. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/90a94b19bcf5aed7bfee94764acc906e889e47f8
  19. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/9ef6a972458b736cdcb1b875bf896104b3a1c74c
  20. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/bab597264c721da916f0245906c4c471547aba89
  21. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/c059728bdb63747b6ebb3e345ac4c5ec5f8363af
  22. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/c5f36039c543bb52b1b2ad235934790c4c34dccd
  23. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/c8ccc96fa43f1446ca99e81e7440a3542b3a6ee2
  24. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-168a72ed6115591c637fe99f50cac5e6bf7ded79
  25. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-3699c47aaa794b48df814bd3b5a982c377063bc7
  26. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-43f9633b24fd27f1bbe8884ec506197e52001797
  27. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-59e58120d4f37a833a79e68372c4eaf361a92240
  28. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-5ba35fa4177ca59450b597dd1a2d48f8a68959dd
  29. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-7c6eb73a27b693a346f309370e965d0d62048503
  30. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-95e740aca3d281f30929d51a628cdfab4ca863ad
  31. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-9c2cf43a9cdba7a35485fadb0b0424a88f7d7b8a
  32. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-b479e66d221f3db92c31b6b6aace69599f648d51
  33. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-c1a4c1aa8b4f1b081993f93ca92a1136a7302be5
  34. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-eec019a7a40f5d8f8c0e9c72215286f442a9b150
  35. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/crash-fc088cee74d4e8dd791291b5575fc0fe9fe7378d
  36. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/d7e298c12f97064ebe494593ecbe26df96f7f84d
  37. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/dcb9a8007d2693d35911dfcde7ae960adbeb2601
  38. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/e061b554b941636414621e0a54d2d1c7014a1ac4
  39. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/e3854bc2e1bc52f498780be3147d6f870e85d8af
  40. BIN
      test/core/end2end/fuzzers/api_fuzzer_corpus/ec89eb7e84e6cf7859ab478362e0ae5227a5e154

@ -197,13 +197,24 @@ static grpc_channel_args *read_args(input_stream *inp) {
return a;
}
struct ssl_artifact_ctx {
typedef struct cred_artifact_ctx {
int num_release;
char *release[3];
};
} cred_artifact_ctx;
#define CRED_ARTIFACT_CTX_INIT \
{ \
0, { 0 } \
}
static void cred_artifact_ctx_finish(cred_artifact_ctx *ctx) {
for (int i = 0; i < ctx->num_release; i++) {
gpr_free(ctx->release[i]);
}
}
const char *read_ssl_artifact(struct ssl_artifact_ctx *ctx, input_stream *inp,
const char **builtins, size_t num_builtins) {
static const char *read_cred_artifact(cred_artifact_ctx *ctx, input_stream *inp,
const char **builtins,
size_t num_builtins) {
uint8_t b = next_byte(inp);
if (b == 0) return NULL;
if (b == 1) return ctx->release[ctx->num_release++] = read_string(inp);
@ -215,33 +226,94 @@ const char *read_ssl_artifact(struct ssl_artifact_ctx *ctx, input_stream *inp,
}
static grpc_channel_credentials *read_ssl_channel_creds(input_stream *inp) {
struct ssl_artifact_ctx ctx = {0, {0}};
cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT;
static const char *builtin_root_certs[] = {test_root_cert};
static const char *builtin_private_keys[] = {
test_server1_key, test_self_signed_client_key, test_signed_client_key};
static const char *builtin_cert_chains[] = {
test_server1_cert, test_self_signed_client_cert, test_signed_client_cert};
const char *root_certs = read_ssl_artifact(
const char *root_certs = read_cred_artifact(
&ctx, inp, builtin_root_certs, GPR_ARRAY_SIZE(builtin_root_certs));
const char *private_key = read_ssl_artifact(
const char *private_key = read_cred_artifact(
&ctx, inp, builtin_private_keys, GPR_ARRAY_SIZE(builtin_private_keys));
const char *certs = read_ssl_artifact(&ctx, inp, builtin_cert_chains,
GPR_ARRAY_SIZE(builtin_cert_chains));
const char *certs = read_cred_artifact(&ctx, inp, builtin_cert_chains,
GPR_ARRAY_SIZE(builtin_cert_chains));
grpc_ssl_pem_key_cert_pair key_cert_pair = {private_key, certs};
grpc_channel_credentials *creds = grpc_ssl_credentials_create(
root_certs, private_key != NULL && certs != NULL ? &key_cert_pair : NULL,
NULL);
for (int i = 0; i < ctx.num_release; i++) {
gpr_free(ctx.release[i]);
}
cred_artifact_ctx_finish(&ctx);
return creds;
}
static grpc_call_credentials *read_call_creds(input_stream *inp) {
switch (next_byte(inp)) {
default:
end(inp);
return NULL;
case 0:
return NULL;
case 1: {
grpc_call_credentials *c1 = read_call_creds(inp);
grpc_call_credentials *c2 = read_call_creds(inp);
if (c1 != NULL && c2 != NULL) {
grpc_call_credentials *out =
grpc_composite_call_credentials_create(c1, c2, NULL);
grpc_call_credentials_release(c1);
grpc_call_credentials_release(c2);
return out;
} else if (c1 != NULL) {
return c1;
} else if (c2 != NULL) {
return c2;
} else {
return NULL;
}
GPR_UNREACHABLE_CODE(return NULL);
}
case 2: {
cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT;
const char *access_token = read_cred_artifact(&ctx, inp, NULL, 0);
grpc_call_credentials *out =
grpc_access_token_credentials_create(access_token, NULL);
cred_artifact_ctx_finish(&ctx);
return out;
}
case 3: {
cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT;
const char *auth_token = read_cred_artifact(&ctx, inp, NULL, 0);
const char *auth_selector = read_cred_artifact(&ctx, inp, NULL, 0);
grpc_call_credentials *out =
grpc_google_iam_credentials_create(auth_token, auth_selector, NULL);
cred_artifact_ctx_finish(&ctx);
return out;
}
/* TODO(ctiller): more cred types here */
}
}
static grpc_channel_credentials *read_channel_creds(input_stream *inp) {
switch (next_byte(inp)) {
case 0:
return read_ssl_channel_creds(inp);
break;
case 1: {
grpc_channel_credentials *c1 = read_channel_creds(inp);
grpc_call_credentials *c2 = read_call_creds(inp);
if (c1 != NULL && c2 != NULL) {
return grpc_composite_channel_credentials_create(c1, c2, NULL);
} else if (c1) {
return c1;
} else if (c2) {
grpc_call_credentials_release(c2);
return NULL;
} else {
return NULL;
}
GPR_UNREACHABLE_CODE(return NULL);
}
case 2:
return NULL;
default:
end(inp);
return NULL;

Loading…
Cancel
Save