From 54f3a388da2a3e60eb5b23dfec36f5ebeafae5b6 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 4 Sep 2018 10:40:17 +0200 Subject: [PATCH] Fixed #4835: BeginPaint callback now optional. --- client/X11/xf_client.c | 12 ------------ libfreerdp/core/fastpath.c | 9 +++------ libfreerdp/core/update.c | 7 +++++-- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 7583d80cf..bb9b87be8 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -283,11 +283,6 @@ static BOOL xf_desktop_resize(rdpContext* context) return TRUE; } -static BOOL xf_sw_begin_paint(rdpContext* context) -{ - return TRUE; -} - static BOOL xf_sw_end_paint(rdpContext* context) { int i; @@ -390,11 +385,6 @@ out: return ret; } -static BOOL xf_hw_begin_paint(rdpContext* context) -{ - return TRUE; -} - static BOOL xf_hw_end_paint(rdpContext* context) { INT32 x, y; @@ -1263,13 +1253,11 @@ static BOOL xf_post_connect(freerdp* instance) if (settings->SoftwareGdi) { - update->BeginPaint = xf_sw_begin_paint; update->EndPaint = xf_sw_end_paint; update->DesktopResize = xf_sw_desktop_resize; } else { - update->BeginPaint = xf_hw_begin_paint; update->EndPaint = xf_hw_end_paint; update->DesktopResize = xf_hw_desktop_resize; } diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index d4f5d249d..c3506063c 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -565,10 +565,11 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) else { const size_t totalSize = Stream_GetPosition(fastpath->updateData); + if (totalSize > transport->settings->MultifragMaxRequestSize) { WLog_ERR(TAG, "Total size (%"PRIuz") exceeds MultifragMaxRequestSize (%"PRIu32")", - totalSize, transport->settings->MultifragMaxRequestSize); + totalSize, transport->settings->MultifragMaxRequestSize); goto out_fail; } @@ -581,8 +582,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) } fastpath->fragmentation = FASTPATH_FRAGMENT_FIRST; - - } else if (fragmentation == FASTPATH_FRAGMENT_NEXT) { @@ -605,7 +604,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) } fastpath->fragmentation = -1; - Stream_SealLength(fastpath->updateData); Stream_SetPosition(fastpath->updateData, 0); status = fastpath_recv_update(fastpath, updateCode, fastpath->updateData); @@ -621,7 +619,6 @@ static int fastpath_recv_update_data(rdpFastPath* fastpath, wStream* s) return status; out_fail: - return -1; } @@ -634,7 +631,7 @@ int fastpath_recv_updates(rdpFastPath* fastpath, wStream* s) update = fastpath->rdp->update; - if (!IFCALLRESULT(FALSE, update->BeginPaint, update->context)) + if (!IFCALLRESULT(TRUE, update->BeginPaint, update->context)) return -2; while (Stream_GetRemainingLength(s) >= 3) diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 7f3a3919a..4237f7bc4 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -130,11 +130,14 @@ static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, if (bitmapData->bitmapLength > 0) { bitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength); + if (!bitmapData->bitmapDataStream) return FALSE; + memcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength); Stream_Seek(s, bitmapData->bitmapLength); } + return TRUE; } @@ -633,9 +636,9 @@ BOOL update_recv(rdpUpdate* update, wStream* s) } Stream_Read_UINT16(s, updateType); /* updateType (2 bytes) */ + WLog_Print(update->log, WLOG_TRACE, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]); - //WLog_DBG(TAG, "%s Update Data PDU", UPDATE_TYPE_STRINGS[updateType]); - if (!IFCALLRESULT(FALSE, update->BeginPaint, context)) + if (!IFCALLRESULT(TRUE, update->BeginPaint, context)) return FALSE; switch (updateType)