1 #include <freerdp/peer.h>
3 #include "../fastpath.h"
4 #include "../surface.h"
7 #include "../multitransport.h"
9 static BOOL test_server(
const uint8_t* Data,
size_t Size)
11 freerdp_peer* client = calloc(1,
sizeof(freerdp_peer));
14 client->ContextSize =
sizeof(rdpContext);
15 if (!freerdp_peer_context_new(client))
18 WINPR_ASSERT(client->context);
19 rdpRdp* rdp = client->context->rdp;
23 wStream* s = Stream_StaticConstInit(&sbuffer, Data, Size);
26 rdpFastPath* fastpath = rdp->fastpath;
27 WINPR_ASSERT(fastpath);
29 fastpath_recv_updates(fastpath, s);
30 fastpath_recv_inputs(fastpath, s);
33 fastpath_read_header_rdp(fastpath, s, &length);
34 fastpath_decrypt(fastpath, s, &length);
41 UINT16 tpktLength = 0;
42 UINT16 remainingLength = 0;
44 UINT16 securityFlags = 0;
46 BYTE compressed_type = 0;
48 UINT16 compressed_len = 0;
49 rdp_read_security_header(rdp, s, &flags, &length);
50 rdp_read_header(rdp, s, &length, &channelId);
51 rdp_read_share_control_header(rdp, s, &tpktLength, &remainingLength, &type, &channelId);
52 rdp_read_share_data_header(rdp, s, &length, &btype, &share_id, &compressed_type,
54 rdp_recv_message_channel_pdu(rdp, s, securityFlags);
57 rdpUpdate* update = rdp->update;
62 update_recv_order(update, s);
63 update_recv_altsec_window_order(update, s);
64 update_recv_play_sound(update, s);
65 update_recv_pointer(update, s);
66 update_recv_surfcmds(update, s);
67 rdp_recv_get_active_header(rdp, s, &channelId, &length);
68 rdp_recv_demand_active(rdp, s, pduSource, length);
69 rdp_recv_confirm_active(rdp, s, pduLength);
72 rdpNla* nla = nla_new(rdp->context, rdp->transport);
77 rdp_recv_heartbeat_packet(rdp, s);
78 rdp->state = CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE;
79 rdp_recv_client_info(rdp, s);
82 freerdp_is_valid_mcs_create_request(Data, Size);
83 freerdp_is_valid_mcs_create_response(Data, Size);
86 multitransport_recv_request(rdp->multitransport, s);
87 multitransport_recv_response(rdp->multitransport, s);
90 autodetect_recv_request_packet(rdp->autodetect, RDP_TRANSPORT_TCP, s);
91 autodetect_recv_response_packet(rdp->autodetect, RDP_TRANSPORT_TCP, s);
94 rdp_recv_deactivate_all(rdp, s);
95 rdp_recv_server_synchronize_pdu(rdp, s);
96 rdp_recv_client_synchronize_pdu(rdp, s);
99 freerdp_peer_context_free(client);
104 int LLVMFuzzerTestOneInput(
const uint8_t* Data,
size_t Size)
106 test_server(Data, Size);