From 11a518995ec0c0fd3d833e00d5ae67b7e446edbc Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Tue, 31 Oct 2017 15:15:41 -0700 Subject: [PATCH] LLVMfuzzer extern C --- test/core/client_channel/uri_fuzzer_test.cc | 2 +- test/core/end2end/fuzzers/api_fuzzer.cc | 2 +- test/core/end2end/fuzzers/client_fuzzer.cc | 2 +- test/core/end2end/fuzzers/server_fuzzer.cc | 2 +- test/core/http/request_fuzzer.cc | 2 +- test/core/http/response_fuzzer.cc | 2 +- test/core/json/fuzzer.cc | 2 +- test/core/nanopb/fuzzer_response.cc | 2 +- test/core/nanopb/fuzzer_serverlist.cc | 2 +- test/core/security/ssl_server_fuzzer.cc | 2 +- test/core/slice/percent_decode_fuzzer.cc | 2 +- test/core/slice/percent_encode_fuzzer.cc | 2 +- test/core/transport/chttp2/hpack_parser_fuzzer_test.cc | 2 +- test/core/util/one_corpus_entry_fuzzer.cc | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/core/client_channel/uri_fuzzer_test.cc b/test/core/client_channel/uri_fuzzer_test.cc index 8c071454bcc..9674dadf6c1 100644 --- a/test/core/client_channel/uri_fuzzer_test.cc +++ b/test/core/client_channel/uri_fuzzer_test.cc @@ -28,7 +28,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *s = static_cast(gpr_malloc(size + 1)); memcpy(s, data, size); s[size] = 0; diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 9d313d02557..69d25533f1a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -733,7 +733,7 @@ static validator *make_finished_batch_validator(call_state *cs, return create_validator(finished_batch, bi); } -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_slice_hash_seed(0); char *grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER"); if (squelch && grpc_trace_fuzzer == NULL) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index 88ba6bad83c..bea8ec88b93 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -37,7 +37,7 @@ static void *tag(int n) { return (void *)(uintptr_t)n; } static void dont_log(gpr_log_func_args *args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index ef4c0a4bfda..36b16afc248 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -35,7 +35,7 @@ static int detag(void *p) { return (int)(uintptr_t)p; } static void dont_log(gpr_log_func_args *args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_slice_hash_seed(0); struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); diff --git a/test/core/http/request_fuzzer.cc b/test/core/http/request_fuzzer.cc index aefe9eb0f91..8677fd213ac 100644 --- a/test/core/http/request_fuzzer.cc +++ b/test/core/http/request_fuzzer.cc @@ -27,7 +27,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_http_parser parser; grpc_http_request request; memset(&request, 0, sizeof(request)); diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index d5bb67500d2..e84353f45cd 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -26,7 +26,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_http_parser parser; grpc_http_response response; memset(&response, 0, sizeof(response)); diff --git a/test/core/json/fuzzer.cc b/test/core/json/fuzzer.cc index a8b75f72a2c..58c34e51d1d 100644 --- a/test/core/json/fuzzer.cc +++ b/test/core/json/fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *s; struct grpc_memory_counters counters; grpc_memory_counters_init(); diff --git a/test/core/nanopb/fuzzer_response.cc b/test/core/nanopb/fuzzer_response.cc index c9b63979a18..9a52c3399ae 100644 --- a/test/core/nanopb/fuzzer_response.cc +++ b/test/core/nanopb/fuzzer_response.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args *args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size); grpc_grpclb_initial_response *response; diff --git a/test/core/nanopb/fuzzer_serverlist.cc b/test/core/nanopb/fuzzer_serverlist.cc index dd70f0c3317..75b0bbeceb7 100644 --- a/test/core/nanopb/fuzzer_serverlist.cc +++ b/test/core/nanopb/fuzzer_serverlist.cc @@ -28,7 +28,7 @@ bool leak_check = true; static void dont_log(gpr_log_func_args *args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (squelch) gpr_set_log_function(dont_log); grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size); grpc_grpclb_serverlist *serverlist; diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index 9d43a416c35..8f34e2e4207 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -51,7 +51,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, GPR_ASSERT(error != GRPC_ERROR_NONE); } -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct grpc_memory_counters counters; if (squelch) gpr_set_log_function(dont_log); if (leak_check) grpc_memory_counters_init(); diff --git a/test/core/slice/percent_decode_fuzzer.cc b/test/core/slice/percent_decode_fuzzer.cc index ad4e3fed7ab..2aae3358911 100644 --- a/test/core/slice/percent_decode_fuzzer.cc +++ b/test/core/slice/percent_decode_fuzzer.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { struct grpc_memory_counters counters; grpc_memory_counters_init(); grpc_slice input = grpc_slice_from_copied_buffer((const char *)data, size); diff --git a/test/core/slice/percent_encode_fuzzer.cc b/test/core/slice/percent_encode_fuzzer.cc index db3dc3bb3f4..4813d1218b7 100644 --- a/test/core/slice/percent_encode_fuzzer.cc +++ b/test/core/slice/percent_encode_fuzzer.cc @@ -51,7 +51,7 @@ static void test(const uint8_t *data, size_t size, const uint8_t *dict) { GPR_ASSERT(counters.total_size_relative == 0); } -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { test(data, size, grpc_url_percent_encoding_unreserved_bytes); test(data, size, grpc_compatible_percent_encoding_unreserved_bytes); return 0; diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 03834084cbd..bad74911627 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc @@ -34,7 +34,7 @@ static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) { } static void dont_log(gpr_log_func_args *args) {} -int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { grpc_test_only_set_slice_hash_seed(0); if (squelch) gpr_set_log_function(dont_log); grpc_init(); diff --git a/test/core/util/one_corpus_entry_fuzzer.cc b/test/core/util/one_corpus_entry_fuzzer.cc index 42467390f2d..aebc1bfc295 100644 --- a/test/core/util/one_corpus_entry_fuzzer.cc +++ b/test/core/util/one_corpus_entry_fuzzer.cc @@ -21,7 +21,7 @@ #include #include "src/core/lib/iomgr/load_file.h" -extern int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); extern bool squelch; extern bool leak_check;