server/shadow: Fix incorrect bitmap fragment update.

Legacy bitmap update might fail with 'fast path update size (xxxxx) exceeds the client's maximum request size (xxxxx)'
Original code might update last fragment with exceeded fragment size incorrectly. Fix the logic to prevent it.
This commit is contained in:
zihao.jiang 2017-07-04 23:48:07 +08:00
parent 215fbe8446
commit 2a65e70d08

View File

@ -1095,19 +1095,14 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client,
{ {
newUpdateSize = updateSize + (bitmapData[i].bitmapLength + 16); newUpdateSize = updateSize + (bitmapData[i].bitmapLength + 16);
if ((newUpdateSize < maxUpdateSize) && ((i + 1) < k)) if (newUpdateSize < maxUpdateSize)
{ {
CopyMemory(&fragBitmapData[j++], &bitmapData[i++], sizeof(BITMAP_DATA)); CopyMemory(&fragBitmapData[j++], &bitmapData[i++], sizeof(BITMAP_DATA));
updateSize = newUpdateSize; updateSize = newUpdateSize;
} }
else
{
if ((i + 1) >= k)
{
CopyMemory(&fragBitmapData[j++], &bitmapData[i++], sizeof(BITMAP_DATA));
updateSize = newUpdateSize;
}
if ((newUpdateSize >= maxUpdateSize) || (i + 1) >= k)
{
bitmapUpdate.count = bitmapUpdate.number = j; bitmapUpdate.count = bitmapUpdate.number = j;
IFCALLRET(update->BitmapUpdate, ret, context, &bitmapUpdate); IFCALLRET(update->BitmapUpdate, ret, context, &bitmapUpdate);