Loading system/gd/fuzz/helpers.h +7 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <cstdint> #include <vector> #include "os/handler.h" #include "common/contextual_callback.h" namespace bluetooth { namespace fuzz { Loading @@ -43,7 +43,9 @@ void InvokeIfValid(common::ContextualOnceCallback<void(TView)> callback, std::ve if (!packet.IsValid()) { return; } callback.InvokeIfNotEmpty(packet); if (!callback.IsEmpty()) { callback.Invoke(packet); } } template <typename TView> Loading @@ -52,7 +54,9 @@ void InvokeIfValid(common::ContextualCallback<void(TView)> callback, std::vector if (!packet.IsValid()) { return; } callback.InvokeIfNotEmpty(packet); if (!callback.IsEmpty()) { callback.Invoke(packet); } } } // namespace fuzz Loading system/gd/hci/fuzz/fuzz_hci_layer.cc +10 −4 Original line number Diff line number Diff line Loading @@ -181,18 +181,24 @@ void FuzzHciLayer::injectAclEvent(std::vector<uint8_t> data) { } void FuzzHciLayer::injectAclDisconnect(FuzzedDataProvider& fdp) { acl_on_disconnect_.InvokeIfNotEmpty(fdp.ConsumeIntegral<uint16_t>(), if (!acl_on_disconnect_.IsEmpty()) { acl_on_disconnect_.Invoke( fdp.ConsumeIntegral<uint16_t>(), static_cast<hci::ErrorCode>(fdp.ConsumeIntegral<uint8_t>())); } } void FuzzHciLayer::injectLeAclEvent(std::vector<uint8_t> data) { InvokeIfValid<LeMetaEventView>(le_acl_event_handler_, data); } void FuzzHciLayer::injectLeAclDisconnect(FuzzedDataProvider& fdp) { le_acl_on_disconnect_.InvokeIfNotEmpty(fdp.ConsumeIntegral<uint16_t>(), if (!le_acl_on_disconnect_.IsEmpty()) { le_acl_on_disconnect_.Invoke( fdp.ConsumeIntegral<uint16_t>(), static_cast<hci::ErrorCode>(fdp.ConsumeIntegral<uint8_t>())); } } void FuzzHciLayer::injectLeAdvertisingEvent(std::vector<uint8_t> data) { InvokeIfValid<LeMetaEventView>(le_advertising_event_handler_, data); Loading Loading
system/gd/fuzz/helpers.h +7 −3 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <cstdint> #include <vector> #include "os/handler.h" #include "common/contextual_callback.h" namespace bluetooth { namespace fuzz { Loading @@ -43,7 +43,9 @@ void InvokeIfValid(common::ContextualOnceCallback<void(TView)> callback, std::ve if (!packet.IsValid()) { return; } callback.InvokeIfNotEmpty(packet); if (!callback.IsEmpty()) { callback.Invoke(packet); } } template <typename TView> Loading @@ -52,7 +54,9 @@ void InvokeIfValid(common::ContextualCallback<void(TView)> callback, std::vector if (!packet.IsValid()) { return; } callback.InvokeIfNotEmpty(packet); if (!callback.IsEmpty()) { callback.Invoke(packet); } } } // namespace fuzz Loading
system/gd/hci/fuzz/fuzz_hci_layer.cc +10 −4 Original line number Diff line number Diff line Loading @@ -181,18 +181,24 @@ void FuzzHciLayer::injectAclEvent(std::vector<uint8_t> data) { } void FuzzHciLayer::injectAclDisconnect(FuzzedDataProvider& fdp) { acl_on_disconnect_.InvokeIfNotEmpty(fdp.ConsumeIntegral<uint16_t>(), if (!acl_on_disconnect_.IsEmpty()) { acl_on_disconnect_.Invoke( fdp.ConsumeIntegral<uint16_t>(), static_cast<hci::ErrorCode>(fdp.ConsumeIntegral<uint8_t>())); } } void FuzzHciLayer::injectLeAclEvent(std::vector<uint8_t> data) { InvokeIfValid<LeMetaEventView>(le_acl_event_handler_, data); } void FuzzHciLayer::injectLeAclDisconnect(FuzzedDataProvider& fdp) { le_acl_on_disconnect_.InvokeIfNotEmpty(fdp.ConsumeIntegral<uint16_t>(), if (!le_acl_on_disconnect_.IsEmpty()) { le_acl_on_disconnect_.Invoke( fdp.ConsumeIntegral<uint16_t>(), static_cast<hci::ErrorCode>(fdp.ConsumeIntegral<uint8_t>())); } } void FuzzHciLayer::injectLeAdvertisingEvent(std::vector<uint8_t> data) { InvokeIfValid<LeMetaEventView>(le_advertising_event_handler_, data); Loading