@@ -73,7 +73,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize)
73
73
// For now, just dump the data as a UDP payload into the session manager.
74
74
// But maybe we should try to separately extract a PeerAddress and data from
75
75
// the incoming data?
76
- Transport::PeerAddress peerAddr;
76
+
77
+ // dumping payload with random transport types
78
+ Transport::Type randomTransportType = static_cast <Transport::Type>(*aData % 5 );
79
+ Transport::PeerAddress peerAddr (randomTransportType);
80
+
77
81
System::PacketBufferHandle buf =
78
82
System::PacketBufferHandle::NewWithData (aData, aSize, /* aAdditionalSize = */ 0 , /* aReservedSize = */ 0 );
79
83
if (buf.IsNull ())
@@ -84,8 +88,17 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t * aData, size_t aSize)
84
88
85
89
// Ignoring the return value from OnMessageReceived, because we might be
86
90
// passing it all sorts of garbage that will cause it to fail.
87
- Server::GetInstance ().GetSecureSessionManager ().OnMessageReceived (peerAddr, std::move (buf));
88
91
92
+ // for TCP we need to have MessageTransportContext
93
+ if (randomTransportType == Transport::Type::kTcp )
94
+ {
95
+ Transport::MessageTransportContext msgContext;
96
+ Server::GetInstance ().GetSecureSessionManager ().OnMessageReceived (peerAddr, std::move (buf), &msgContext);
97
+ }
98
+ else
99
+ {
100
+ Server::GetInstance ().GetSecureSessionManager ().OnMessageReceived (peerAddr, std::move (buf));
101
+ }
89
102
// Now process pending events until our sentinel is reached.
90
103
PlatformMgr ().ScheduleWork ([](intptr_t ) { PlatformMgr ().StopEventLoopTask (); });
91
104
PlatformMgr ().RunEventLoop ();
0 commit comments