MCPcopy Create free account
hub / github.com/apache/brpc / get_fuzz_socket

Function get_fuzz_socket

test/fuzzing/fuzz_common.h:27–42  ·  view source on GitHub ↗

Create a valid Socket for use in fuzz harnesses that need a non-NULL Socket*. Returns a raw Socket* that remains valid for the lifetime of the process (held by the static SocketUniquePtr).

Source from the content-addressed store, hash-verified

25// Returns a raw Socket* that remains valid for the lifetime of the process
26// (held by the static SocketUniquePtr).
27inline brpc::Socket* get_fuzz_socket() {
28 static brpc::SocketId sid = 0;
29 static brpc::SocketUniquePtr sock_ptr;
30 static bool initialized = false;
31
32 if (!initialized) {
33 brpc::SocketOptions options;
34 options.remote_side = butil::EndPoint(butil::IP_ANY, 7777);
35 if (brpc::Socket::Create(options, &sid) == 0) {
36 brpc::Socket::Address(sid, &sock_ptr);
37 }
38 initialized = true;
39 }
40
41 return sock_ptr.get();
42}
43
44#endif // BRPC_TEST_FUZZING_FUZZ_COMMON_H

Callers 9

LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85

Calls 2

EndPointClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected