3 * Copyright 2016 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
21 #include <grpc/grpc.h>
23 #include <grpc/support/log.h>
24 #include "src/core/lib/iomgr/exec_ctx.h"
25 #include "src/core/lib/iomgr/load_file.h"
27 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
30 extern bool leak_check;
32 int main(int argc, char** argv) {
36 /* TODO(yashkt) Calling grpc_init breaks tests. Fix the tests and replace
37 * grpc_core::ExecCtx::GlobalInit with grpc_init and GlobalShutdown with
39 GPR_ASSERT(argc > 1); /* Make sure that we have a filename argument */
41 GRPC_LOG_IF_ERROR("load_file", grpc_load_file(argv[1], 0, &buffer)));
42 LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer),
43 GRPC_SLICE_LENGTH(buffer));
44 grpc_core::ExecCtx::GlobalInit();
45 grpc_slice_unref(buffer);
46 grpc_core::ExecCtx::GlobalShutdown();