libfreerdp-core: fix reading TS_ICON_INFO

The spec says that CbColorTable field is present when Bpp is 1, 4, 8.
Actually, bpp == 2 is not supported by TS_ICON_INFO according to the
spec (though, DIB definitely supports 16-color images).

    MS-RDPERP 2.2.1.2.3 Icon Info (TS_ICON_INFO)

    CbColorTable (2 bytes):
        This field is ONLY present if the bits per pixel (Bpp)
        value is 1, 4, or 8.

Omitting 8-bit value breaks 256-color icons which are incorrectly
read with color and alpha data mixed up.
This commit is contained in:
ilammy 2018-11-10 22:09:20 +02:00 committed by Armin Novak
parent ca6d1d5919
commit 7a2b6e1301

View File

@ -86,8 +86,8 @@ BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
Stream_Read_UINT16(s, iconInfo->width); /* width (2 bytes) */
Stream_Read_UINT16(s, iconInfo->height); /* height (2 bytes) */
/* cbColorTable is only present when bpp is 1, 2 or 4 */
if (iconInfo->bpp == 1 || iconInfo->bpp == 2 || iconInfo->bpp == 4)
/* cbColorTable is only present when bpp is 1, 4 or 8 */
if (iconInfo->bpp == 1 || iconInfo->bpp == 4 || iconInfo->bpp == 8)
{
if (Stream_GetRemainingLength(s) < 2)
return FALSE;