From 0f116eb28262d947ae8b73718254a2e83bd048ae Mon Sep 17 00:00:00 2001 From: Hope Casey-Allen Date: Tue, 24 Sep 2019 10:53:18 -0700 Subject: [PATCH] Fix --- src/core/lib/surface/server.cc | 4 +-- test/core/end2end/fuzzers/server_fuzzer.cc | 5 ++-- .../fuzzers/server_fuzzer_corpus/hope.bin | Bin 0 -> 407 bytes tools/run_tests/generated/tests.json | 23 ++++++++++++++++++ 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 test/core/end2end/fuzzers/server_fuzzer_corpus/hope.bin diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index 1279a0080bc..c14b7ba62b3 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -633,7 +633,7 @@ static void start_new_rpc(grpc_call_element* elem) { for (i = 0; i <= chand->registered_method_max_probes; i++) { rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; - if (!rm) break; + if (rm->server_registered_method == nullptr) break; if (!rm->has_host) continue; if (!grpc_slice_eq(rm->host, calld->host)) continue; if (!grpc_slice_eq(rm->method, calld->path)) continue; @@ -651,7 +651,7 @@ static void start_new_rpc(grpc_call_element* elem) { for (i = 0; i <= chand->registered_method_max_probes; i++) { rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; - if (!rm) break; + if (rm->server_registered_method == nullptr) break; if (rm->has_host) continue; if (!grpc_slice_eq(rm->method, calld->path)) continue; if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) && diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index 130b58f6292..031db87dc2e 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -57,9 +57,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_server* server = grpc_server_create(nullptr, nullptr); grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); grpc_server_register_completion_queue(server, cq, nullptr); - // TODO(ctiller): add registered methods (one for POST, one for PUT) - // void *registered_method = - // grpc_server_register_method(server, "/reg", NULL, 0); + // TODO(ctiller): add more registered methods (one for POST, one for PUT) + grpc_server_register_method(server, "/reg", nullptr, {}, 0); grpc_server_start(server); grpc_transport* transport = grpc_create_chttp2_transport(nullptr, mock_endpoint, false); diff --git a/test/core/end2end/fuzzers/server_fuzzer_corpus/hope.bin b/test/core/end2end/fuzzers/server_fuzzer_corpus/hope.bin new file mode 100644 index 0000000000000000000000000000000000000000..46dd6219518b803580b00d01b475ffbe8c1902d8 GIT binary patch literal 407 zcmZ8dK~BRk5ZsoeL{S4A;O+wlpiR<*Nrr=&<|LSNi0Q<C2*NfL zsf^{ZJTuz0cky^nF38<-xyZ|GlEg{;^xzoaGyspj=RMB>PKHh0OV{2?WBXM(3lvmlru3}b{ms1+fG{XjHA4P*~isk}Ct(|ElSCS|ov+&CfSqfuUD