Fix #4868: Allow empty bands data.
This commit is contained in:
parent
24936c1858
commit
13e59b5d6a
@ -634,7 +634,6 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
|
|||||||
UINT16 yEnd;
|
UINT16 yEnd;
|
||||||
UINT32 colorBkg;
|
UINT32 colorBkg;
|
||||||
UINT16 vBarHeader;
|
UINT16 vBarHeader;
|
||||||
UINT16 vBarIndex;
|
|
||||||
UINT16 vBarYOn;
|
UINT16 vBarYOn;
|
||||||
UINT16 vBarYOff;
|
UINT16 vBarYOff;
|
||||||
UINT32 vBarCount;
|
UINT32 vBarCount;
|
||||||
@ -697,7 +696,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
|
|||||||
|
|
||||||
if ((vBarHeader & 0xC000) == 0x4000) /* SHORT_VBAR_CACHE_HIT */
|
if ((vBarHeader & 0xC000) == 0x4000) /* SHORT_VBAR_CACHE_HIT */
|
||||||
{
|
{
|
||||||
vBarIndex = (vBarHeader & 0x3FFF);
|
const UINT16 vBarIndex = (vBarHeader & 0x3FFF);
|
||||||
vBarShortEntry = &(clear->ShortVBarStorage[vBarIndex]);
|
vBarShortEntry = &(clear->ShortVBarStorage[vBarIndex]);
|
||||||
|
|
||||||
if (!vBarShortEntry)
|
if (!vBarShortEntry)
|
||||||
@ -779,8 +778,18 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
|
|||||||
}
|
}
|
||||||
else if ((vBarHeader & 0x8000) == 0x8000) /* VBAR_CACHE_HIT */
|
else if ((vBarHeader & 0x8000) == 0x8000) /* VBAR_CACHE_HIT */
|
||||||
{
|
{
|
||||||
vBarIndex = (vBarHeader & 0x7FFF);
|
const UINT16 vBarIndex = (vBarHeader & 0x7FFF);
|
||||||
vBarEntry = &(clear->VBarStorage[vBarIndex]);
|
vBarEntry = &(clear->VBarStorage[vBarIndex]);
|
||||||
|
|
||||||
|
/* If the cache was reset we need to fill in some dummy data. */
|
||||||
|
if (vBarEntry->size == 0)
|
||||||
|
{
|
||||||
|
WLog_WARN(TAG, "Empty cache index %"PRIu16", filling dummy data", vBarIndex);
|
||||||
|
vBarEntry->count = vBarHeight;
|
||||||
|
|
||||||
|
if (!resize_vbar_entry(clear, vBarEntry))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -169,6 +169,24 @@
|
|||||||
|
|
||||||
static int rdp_client_connect_finalize(rdpRdp* rdp);
|
static int rdp_client_connect_finalize(rdpRdp* rdp);
|
||||||
|
|
||||||
|
|
||||||
|
static BOOL rdp_client_reset_codecs(rdpContext* context)
|
||||||
|
{
|
||||||
|
rdpSettings* settings;
|
||||||
|
|
||||||
|
if (!context || !context->settings)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
settings = context->settings;
|
||||||
|
context->codecs = codecs_new(context);
|
||||||
|
|
||||||
|
if (!context->codecs)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
|
||||||
|
settings->DesktopWidth, settings->DesktopHeight);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Establish RDP Connection based on the settings given in the 'rdp' parameter.
|
* Establish RDP Connection based on the settings given in the 'rdp' parameter.
|
||||||
* @msdn{cc240452}
|
* @msdn{cc240452}
|
||||||
@ -183,6 +201,9 @@ BOOL rdp_client_connect(rdpRdp* rdp)
|
|||||||
/* make sure SSL is initialize for earlier enough for crypto, by taking advantage of winpr SSL FIPS flag for openssl initialization */
|
/* make sure SSL is initialize for earlier enough for crypto, by taking advantage of winpr SSL FIPS flag for openssl initialization */
|
||||||
DWORD flags = WINPR_SSL_INIT_DEFAULT;
|
DWORD flags = WINPR_SSL_INIT_DEFAULT;
|
||||||
|
|
||||||
|
if (!rdp_client_reset_codecs(rdp->context))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (settings->FIPSMode)
|
if (settings->FIPSMode)
|
||||||
flags |= WINPR_SSL_INIT_ENABLE_FIPS;
|
flags |= WINPR_SSL_INIT_ENABLE_FIPS;
|
||||||
|
|
||||||
@ -336,6 +357,7 @@ BOOL rdp_client_disconnect(rdpRdp* rdp)
|
|||||||
if (freerdp_channels_disconnect(context->channels, context->instance) != CHANNEL_RC_OK)
|
if (freerdp_channels_disconnect(context->channels, context->instance) != CHANNEL_RC_OK)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
codecs_free(context->codecs);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,6 @@ BOOL freerdp_connect(freerdp* instance)
|
|||||||
ResetEvent(instance->context->abortEvent);
|
ResetEvent(instance->context->abortEvent);
|
||||||
rdp = instance->context->rdp;
|
rdp = instance->context->rdp;
|
||||||
settings = instance->settings;
|
settings = instance->settings;
|
||||||
instance->context->codecs = codecs_new(instance->context);
|
|
||||||
IFCALLRET(instance->PreConnect, status, instance);
|
IFCALLRET(instance->PreConnect, status, instance);
|
||||||
instance->ConnectionCallbackState = CLIENT_STATE_PRECONNECT_PASSED;
|
instance->ConnectionCallbackState = CLIENT_STATE_PRECONNECT_PASSED;
|
||||||
|
|
||||||
@ -525,7 +524,6 @@ BOOL freerdp_disconnect(freerdp* instance)
|
|||||||
instance->update->pcap_rfx = NULL;
|
instance->update->pcap_rfx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
codecs_free(instance->context->codecs);
|
|
||||||
freerdp_channels_close(instance->context->channels, instance);
|
freerdp_channels_close(instance->context->channels, instance);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,8 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||||||
"destLeft %"PRIu32" destTop %"PRIu32" destRight %"PRIu32" destBottom %"PRIu32" "
|
"destLeft %"PRIu32" destTop %"PRIu32" destRight %"PRIu32" destBottom %"PRIu32" "
|
||||||
"bpp %"PRIu8" flags %"PRIx8" codecID %"PRIu16" width %"PRIu16" height %"PRIu16" length %"PRIu32"",
|
"bpp %"PRIu8" flags %"PRIx8" codecID %"PRIu16" width %"PRIu16" height %"PRIu16" length %"PRIu32"",
|
||||||
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||||
cmd->bmp.bpp, cmd->bmp.flags, cmd->bmp.codecID, cmd->bmp.width, cmd->bmp.height, cmd->bmp.bitmapDataLength);
|
cmd->bmp.bpp, cmd->bmp.flags, cmd->bmp.codecID, cmd->bmp.width, cmd->bmp.height,
|
||||||
|
cmd->bmp.bitmapDataLength);
|
||||||
region16_init(®ion);
|
region16_init(®ion);
|
||||||
cmdRect.left = cmd->destLeft;
|
cmdRect.left = cmd->destLeft;
|
||||||
cmdRect.top = cmd->destTop;
|
cmdRect.top = cmd->destTop;
|
||||||
@ -1035,7 +1036,7 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||||||
{
|
{
|
||||||
case RDP_CODEC_ID_REMOTEFX:
|
case RDP_CODEC_ID_REMOTEFX:
|
||||||
if (!rfx_process_message(context->codecs->rfx, cmd->bmp.bitmapData,
|
if (!rfx_process_message(context->codecs->rfx, cmd->bmp.bitmapData,
|
||||||
cmd->bmp.bitmapDataLength,
|
cmd->bmp.bitmapDataLength,
|
||||||
cmd->destLeft, cmd->destTop,
|
cmd->destLeft, cmd->destTop,
|
||||||
gdi->primary_buffer, gdi->dstFormat,
|
gdi->primary_buffer, gdi->dstFormat,
|
||||||
gdi->stride, gdi->height, ®ion))
|
gdi->stride, gdi->height, ®ion))
|
||||||
@ -1050,10 +1051,10 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||||||
format = gdi->dstFormat;
|
format = gdi->dstFormat;
|
||||||
|
|
||||||
if (!nsc_process_message(context->codecs->nsc, cmd->bmp.bpp, cmd->bmp.width,
|
if (!nsc_process_message(context->codecs->nsc, cmd->bmp.bpp, cmd->bmp.width,
|
||||||
cmd->bmp.height, cmd->bmp.bitmapData,
|
cmd->bmp.height, cmd->bmp.bitmapData,
|
||||||
cmd->bmp.bitmapDataLength, gdi->primary_buffer,
|
cmd->bmp.bitmapDataLength, gdi->primary_buffer,
|
||||||
format, gdi->stride, cmd->destLeft, cmd->destTop,
|
format, gdi->stride, cmd->destLeft, cmd->destTop,
|
||||||
cmd->bmp.width, cmd->bmp.height, FREERDP_FLIP_VERTICAL))
|
cmd->bmp.width, cmd->bmp.height, FREERDP_FLIP_VERTICAL))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Failed to process NSCodec message");
|
WLog_ERR(TAG, "Failed to process NSCodec message");
|
||||||
goto out;
|
goto out;
|
||||||
@ -1066,8 +1067,8 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||||||
format = gdi_get_pixel_format(cmd->bmp.bpp);
|
format = gdi_get_pixel_format(cmd->bmp.bpp);
|
||||||
|
|
||||||
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
||||||
cmd->destLeft, cmd->destTop, cmd->bmp.width, cmd->bmp.height,
|
cmd->destLeft, cmd->destTop, cmd->bmp.width, cmd->bmp.height,
|
||||||
cmd->bmp.bitmapData, format, 0, 0, 0,
|
cmd->bmp.bitmapData, format, 0, 0, 0,
|
||||||
&gdi->palette, FREERDP_FLIP_VERTICAL))
|
&gdi->palette, FREERDP_FLIP_VERTICAL))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Failed to process nocodec message");
|
WLog_ERR(TAG, "Failed to process nocodec message");
|
||||||
@ -1287,10 +1288,6 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
|
|||||||
if (!(context->cache = cache_new(instance->settings)))
|
if (!(context->cache = cache_new(instance->settings)))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
if (!freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
|
|
||||||
gdi->width, gdi->height))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
gdi_register_update_callbacks(instance->update);
|
gdi_register_update_callbacks(instance->update);
|
||||||
brush_cache_register_callbacks(instance->update);
|
brush_cache_register_callbacks(instance->update);
|
||||||
glyph_cache_register_callbacks(instance->update);
|
glyph_cache_register_callbacks(instance->update);
|
||||||
|
Loading…
Reference in New Issue
Block a user