Skip to content
Permalink
Browse files Browse the repository at this point in the history
Thanks to Eyal Itkin from Check Point Software Technologies.
  • Loading branch information
akallabeth committed Nov 20, 2018
1 parent 445a5a4 commit 09b9d4f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libfreerdp/gdi/graphics.c
Expand Up @@ -141,9 +141,17 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
{
UINT32 SrcSize = length;
rdpGdi* gdi = context->gdi;
UINT32 size = DstWidth * DstHeight;
bitmap->compressed = FALSE;
bitmap->format = gdi->dstFormat;
bitmap->length = DstWidth * DstHeight * GetBytesPerPixel(bitmap->format);

if ((GetBytesPerPixel(bitmap->format) == 0) ||
(DstWidth == 0) || (DstHeight == 0) || (DstWidth > UINT32_MAX / DstHeight) ||
(size > (UINT32_MAX / GetBytesPerPixel(bitmap->format))))
return FALSE;

size *= GetBytesPerPixel(bitmap->format);
bitmap->length = size;
bitmap->data = (BYTE*) _aligned_malloc(bitmap->length, 16);

if (!bitmap->data)
Expand Down

0 comments on commit 09b9d4f

Please sign in to comment.