Allow icon info with empty bitmap data.
This commit is contained in:
parent
232c7f4783
commit
6c0aeb10d2
@ -95,7 +95,7 @@ BOOL utf8_string_to_rail_string(const char* string, RAIL_UNICODE_STRING* unicode
|
|||||||
/* See [MS-RDPERP] 2.2.1.2.3 Icon Info (TS_ICON_INFO) */
|
/* See [MS-RDPERP] 2.2.1.2.3 Icon Info (TS_ICON_INFO) */
|
||||||
static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
||||||
{
|
{
|
||||||
BYTE* newBitMask;
|
BYTE* newBitMask = NULL;
|
||||||
|
|
||||||
if (Stream_GetRemainingLength(s) < 8)
|
if (Stream_GetRemainingLength(s) < 8)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -137,32 +137,31 @@ static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
|||||||
Stream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */
|
Stream_Read_UINT16(s, iconInfo->cbBitsColor); /* cbBitsColor (2 bytes) */
|
||||||
|
|
||||||
/* bitsMask */
|
/* bitsMask */
|
||||||
newBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
if (iconInfo->cbBitsMask > 0)
|
||||||
|
{
|
||||||
|
newBitMask = (BYTE*)realloc(iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||||
|
|
||||||
if (!newBitMask)
|
if (!newBitMask)
|
||||||
|
{
|
||||||
|
free(iconInfo->bitsMask);
|
||||||
|
iconInfo->bitsMask = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
iconInfo->bitsMask = newBitMask;
|
||||||
|
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask)
|
||||||
|
return FALSE;
|
||||||
|
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
free(iconInfo->bitsMask);
|
free(iconInfo->bitsMask);
|
||||||
iconInfo->bitsMask = NULL;
|
iconInfo->bitsMask = NULL;
|
||||||
return FALSE;
|
iconInfo->cbBitsMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
iconInfo->bitsMask = newBitMask;
|
|
||||||
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsMask)
|
|
||||||
return FALSE;
|
|
||||||
Stream_Read(s, iconInfo->bitsMask, iconInfo->cbBitsMask);
|
|
||||||
|
|
||||||
/* colorTable */
|
/* colorTable */
|
||||||
if (iconInfo->colorTable == NULL)
|
if (iconInfo->cbColorTable > 0)
|
||||||
{
|
|
||||||
if (iconInfo->cbColorTable)
|
|
||||||
{
|
|
||||||
iconInfo->colorTable = (BYTE*)malloc(iconInfo->cbColorTable);
|
|
||||||
|
|
||||||
if (!iconInfo->colorTable)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (iconInfo->cbColorTable)
|
|
||||||
{
|
{
|
||||||
BYTE* new_tab;
|
BYTE* new_tab;
|
||||||
new_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);
|
new_tab = (BYTE*)realloc(iconInfo->colorTable, iconInfo->cbColorTable);
|
||||||
@ -190,19 +189,28 @@ static BOOL update_read_icon_info(wStream* s, ICON_INFO* iconInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* bitsColor */
|
/* bitsColor */
|
||||||
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
if (iconInfo->cbBitsColor > 0)
|
||||||
|
{
|
||||||
|
newBitMask = (BYTE*)realloc(iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||||
|
|
||||||
if (!newBitMask)
|
if (!newBitMask)
|
||||||
|
{
|
||||||
|
free(iconInfo->bitsColor);
|
||||||
|
iconInfo->bitsColor = NULL;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
iconInfo->bitsColor = newBitMask;
|
||||||
|
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsColor)
|
||||||
|
return FALSE;
|
||||||
|
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
free(iconInfo->bitsColor);
|
free(iconInfo->bitsColor);
|
||||||
iconInfo->bitsColor = NULL;
|
iconInfo->bitsColor = NULL;
|
||||||
return FALSE;
|
iconInfo->cbBitsColor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
iconInfo->bitsColor = newBitMask;
|
|
||||||
if (Stream_GetRemainingLength(s) < iconInfo->cbBitsColor)
|
|
||||||
return FALSE;
|
|
||||||
Stream_Read(s, iconInfo->bitsColor, iconInfo->cbBitsColor);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user