1 #include <freerdp/client.h>
3 #include "../fastpath.h"
4 #include "../surface.h"
7 #include "../multitransport.h"
9 static BOOL test_client(
const uint8_t* Data,
size_t Size)
11 RDP_CLIENT_ENTRY_POINTS entry = { 0 };
13 entry.Version = RDP_CLIENT_INTERFACE_VERSION;
14 entry.Size =
sizeof(RDP_CLIENT_ENTRY_POINTS_V1);
15 entry.ContextSize =
sizeof(rdpContext);
17 rdpContext* context = freerdp_client_context_new(&entry);
21 rdpRdp* rdp = context->rdp;
25 wStream* s = Stream_StaticConstInit(&sbuffer, Data, Size);
28 rdpFastPath* fastpath = rdp->fastpath;
29 WINPR_ASSERT(fastpath);
31 fastpath_recv_updates(fastpath, s);
32 fastpath_recv_inputs(fastpath, s);
35 fastpath_read_header_rdp(fastpath, s, &length);
36 fastpath_decrypt(fastpath, s, &length);
43 UINT16 tpktLength = 0;
44 UINT16 remainingLength = 0;
46 UINT16 securityFlags = 0;
48 BYTE compressed_type = 0;
50 UINT16 compressed_len = 0;
52 rdp_recv_callback(rdp->transport, s, rdp);
53 rdp_read_security_header(rdp, s, &flags, &length);
54 rdp_read_header(rdp, s, &length, &channelId);
55 rdp_read_share_control_header(rdp, s, &tpktLength, &remainingLength, &type, &channelId);
56 rdp_read_share_data_header(rdp, s, &length, &btype, &share_id, &compressed_type,
58 rdp_recv_enhanced_security_redirection_packet(rdp, s);
59 rdp_recv_out_of_sequence_pdu(rdp, s, type, length);
60 rdp_recv_message_channel_pdu(rdp, s, securityFlags);
63 rdpUpdate* update = rdp->update;
68 update_recv_order(update, s);
69 update_recv_altsec_window_order(update, s);
70 update_recv_play_sound(update, s);
71 update_recv_pointer(update, s);
72 update_recv_surfcmds(update, s);
73 rdp_recv_get_active_header(rdp, s, &channelId, &length);
74 rdp_recv_demand_active(rdp, s, pduSource, length);
75 rdp_recv_confirm_active(rdp, s, pduLength);
78 rdpNla* nla = nla_new(rdp->context, rdp->transport);
83 rdp_recv_heartbeat_packet(rdp, s);
84 rdp->state = CONNECTION_STATE_SECURE_SETTINGS_EXCHANGE;
85 rdp_recv_client_info(rdp, s);
86 rdp_recv_save_session_info(rdp, s);
89 freerdp_is_valid_mcs_create_request(Data, Size);
90 freerdp_is_valid_mcs_create_response(Data, Size);
93 multitransport_recv_request(rdp->multitransport, s);
94 multitransport_recv_response(rdp->multitransport, s);
97 autodetect_recv_request_packet(rdp->autodetect, RDP_TRANSPORT_TCP, s);
98 autodetect_recv_response_packet(rdp->autodetect, RDP_TRANSPORT_TCP, s);
101 rdp_recv_deactivate_all(rdp, s);
102 rdp_recv_server_synchronize_pdu(rdp, s);
103 rdp_recv_client_synchronize_pdu(rdp, s);
105 rdp_recv_data_pdu(rdp, s);
106 rdp_recv_font_map_pdu(rdp, s);
109 freerdp_client_context_free(context);
113 int LLVMFuzzerTestOneInput(
const uint8_t* Data,
size_t Size)
115 test_client(Data, Size);