diff options
author | David Garcia Quintas <dgq@google.com> | 2016-06-02 10:24:51 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-06-02 10:24:51 -0700 |
commit | e7518461c24b7f8745a3f1246081ce35eb4db68b (patch) | |
tree | 742669980975a5d229a1f50e796704a70c706ca4 /test/core/end2end/fuzzers | |
parent | 772f4853347860d394a7db08a89c2030cd271513 (diff) | |
parent | f78b822db787421bfd90a747ed6fdbb1d3dd4b80 (diff) |
Merge branch 'master' of github.com:grpc/grpc into lr_hook
Diffstat (limited to 'test/core/end2end/fuzzers')
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer.c | 24 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/server_fuzzer.c | 2 |
2 files changed, 15 insertions, 11 deletions
diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c index cdfa960623..e6cd88acee 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.c @@ -252,7 +252,7 @@ static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, bool success) { grpc_transport *transport = grpc_create_chttp2_transport(exec_ctx, NULL, server, 0); - grpc_server_setup_transport(exec_ctx, g_server, transport, NULL); + grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL); grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL, 0); grpc_exec_ctx_enqueue(exec_ctx, fc->closure, false, NULL); @@ -424,15 +424,19 @@ static void add_to_free(call_state *call, void *p) { static void read_metadata(input_stream *inp, size_t *count, grpc_metadata **metadata, call_state *cs) { *count = next_byte(inp); - *metadata = gpr_malloc(*count * sizeof(**metadata)); - memset(*metadata, 0, *count * sizeof(**metadata)); - for (size_t i = 0; i < *count; i++) { - (*metadata)[i].key = read_string(inp); - read_buffer(inp, (char **)&(*metadata)[i].value, - &(*metadata)[i].value_length); - (*metadata)[i].flags = read_uint32(inp); - add_to_free(cs, (void *)(*metadata)[i].key); - add_to_free(cs, (void *)(*metadata)[i].value); + if (*count) { + *metadata = gpr_malloc(*count * sizeof(**metadata)); + memset(*metadata, 0, *count * sizeof(**metadata)); + for (size_t i = 0; i < *count; i++) { + (*metadata)[i].key = read_string(inp); + read_buffer(inp, (char **)&(*metadata)[i].value, + &(*metadata)[i].value_length); + (*metadata)[i].flags = read_uint32(inp); + add_to_free(cs, (void *)(*metadata)[i].key); + add_to_free(cs, (void *)(*metadata)[i].value); + } + } else { + *metadata = gpr_malloc(1); } add_to_free(cs, *metadata); } diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c index 40273711ab..0a7d6d92aa 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.c @@ -69,7 +69,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_server_start(server); grpc_transport *transport = grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 0); - grpc_server_setup_transport(&exec_ctx, server, transport, NULL); + grpc_server_setup_transport(&exec_ctx, server, transport, NULL, NULL); grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL, 0); grpc_call *call1 = NULL; |