From: Bernhard Miklautz Date: Wed, 15 Jul 2020 16:04:02 +0000 (+0200) Subject: new [orders]: BMF_24BPP support and some comments X-Git-Tag: 2.3.0~120^2~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c94e9ea14b2fa3176a6a34c21ac9682526811fb6;p=platform%2Fupstream%2Ffreerdp.git new [orders]: BMF_24BPP support and some comments * cached brush orders missed the BMF_24BPP documented case ([MS-RDPEGDI] 2.2.2.2.1.2.7) * add some comments on secondary (brush) order details (cherry picked from commit efdc99528f6fb6d56537a5420bfa8e735219eba0) --- diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 595e962..6db92b0 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -2714,6 +2714,8 @@ static CACHE_BRUSH_ORDER* update_read_cache_brush_order(rdpUpdate* update, wStre Stream_Read_UINT8(s, cache_brush->cx); /* cx (1 byte) */ Stream_Read_UINT8(s, cache_brush->cy); /* cy (1 byte) */ + /* according to Section 2.2.2.2.1.2.7 errata the windows implementation sets this filed is set + * to 0x00 */ Stream_Read_UINT8(s, cache_brush->style); /* style (1 byte) */ Stream_Read_UINT8(s, cache_brush->length); /* iBytes (1 byte) */ @@ -2728,14 +2730,12 @@ static CACHE_BRUSH_ORDER* update_read_cache_brush_order(rdpUpdate* update, wStre goto fail; } - /* rows are encoded in reverse order */ if (Stream_GetRemainingLength(s) < 8) goto fail; + /* rows are encoded in reverse order */ for (i = 7; i >= 0; i--) - { Stream_Read_UINT8(s, cache_brush->data[i]); - } } else { @@ -2743,6 +2743,8 @@ static CACHE_BRUSH_ORDER* update_read_cache_brush_order(rdpUpdate* update, wStre compressed = TRUE; else if ((iBitmapFormat == BMF_16BPP) && (cache_brush->length == 24)) compressed = TRUE; + else if ((iBitmapFormat == BMF_24BPP) && (cache_brush->length == 28)) + compressed = TRUE; else if ((iBitmapFormat == BMF_32BPP) && (cache_brush->length == 32)) compressed = TRUE; @@ -3673,6 +3675,10 @@ static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flag Stream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */ Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */ Stream_Read_UINT8(s, orderType); /* orderType (1 byte) */ + /* + * According to [MS-RDPEGDI] 2.2.2.2.1.2.1.1 the order length must be increased by 13 bytes + * including the header. As we already read the header 7 left + */ if (Stream_GetRemainingLength(s) < orderLength + 7U) { WLog_Print(update->log, WLOG_ERROR, "Stream_GetRemainingLength(s) %" PRIuz " < %" PRIu16,