Loading system/stack/fuzzers/rfcomm_fuzzer.cc +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <base/location.h> #include <bluetooth/log.h> #include <fuzzer/FuzzedDataProvider.h> #include <gmock/gmock.h> #include <cstdint> #include <iostream> Loading Loading @@ -103,6 +104,15 @@ public: FakeBtStack fake_stack; }; class Mocks { public: ::testing::NiceMock<bluetooth::rfcomm::MockRfcommCallback> mock_rfcomm_callback; Mocks() { rfcomm_callback = &mock_rfcomm_callback; } ~Mocks() { rfcomm_callback = nullptr; } }; } // namespace static int Cleanup(uint16_t* server_handle) { return RFCOMM_RemoveServer(*server_handle); } Loading Loading @@ -198,6 +208,7 @@ static void FuzzAsClient(FuzzedDataProvider* fdp) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { auto fakes = std::make_unique<Fakes>(); auto mocks = std::make_unique<Mocks>(); FuzzedDataProvider fdp(data, size); Loading Loading
system/stack/fuzzers/rfcomm_fuzzer.cc +11 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <base/location.h> #include <bluetooth/log.h> #include <fuzzer/FuzzedDataProvider.h> #include <gmock/gmock.h> #include <cstdint> #include <iostream> Loading Loading @@ -103,6 +104,15 @@ public: FakeBtStack fake_stack; }; class Mocks { public: ::testing::NiceMock<bluetooth::rfcomm::MockRfcommCallback> mock_rfcomm_callback; Mocks() { rfcomm_callback = &mock_rfcomm_callback; } ~Mocks() { rfcomm_callback = nullptr; } }; } // namespace static int Cleanup(uint16_t* server_handle) { return RFCOMM_RemoveServer(*server_handle); } Loading Loading @@ -198,6 +208,7 @@ static void FuzzAsClient(FuzzedDataProvider* fdp) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { auto fakes = std::make_unique<Fakes>(); auto mocks = std::make_unique<Mocks>(); FuzzedDataProvider fdp(data, size); Loading