Merge pull request #2933 from realjiangms/fix_gdi_bitmap_update

GDI: Fix gdi_bitmap_update to check dest buffer size.
This commit is contained in:
Martin Fleisz 2015-10-20 08:44:52 +02:00
commit d0cda5a5c7

View File

@ -536,9 +536,14 @@ static BOOL gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
pDstData = gdi->primary_buffer;
nDstStep = gdi->width * gdi->bytesPerPixel;
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
nWidth = MIN(bitmap->destRight, gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
nHeight = MIN(bitmap->destBottom, gdi->height - 1) - bitmap->destTop + 1; /* clip height */
if (nWidth <= 0 || nHeight <= 0)
{
/* Empty bitmap */
continue;
}
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, gdi->format, nSrcStep, nXSrc, nYSrc, gdi->palette);