if (!gdi || !gdi->primary)
return FALSE;
- if (gdi->width == width && gdi->height == height &&
- (!buffer || gdi->primary_buffer == buffer))
+ if ((width > INT32_MAX) || (height > INT32_MAX))
+ return FALSE;
+
+ if ((gdi->width == (INT32)width) && (gdi->height == (INT32)height) &&
+ (!buffer || (gdi->primary_buffer == buffer)))
return TRUE;
if (gdi->drawing == gdi->primary)
gdi->drawing = NULL;
- gdi->width = width;
- gdi->height = height;
+ gdi->width = (INT32)width;
+ gdi->height = (INT32)height;
gdi_bitmap_free_ex(gdi->primary);
gdi->primary = NULL;
gdi->primary_buffer = NULL;
{
int rc = -1;
UINT32 format = PIXEL_FORMAT_ARGB32;
- UINT32 width;
- UINT32 height;
+ INT32 width;
+ INT32 height;
BYTE* data;
HGDI_BITMAP hBitmap = NULL;
width = 32;
{
int rc = -1;
HGDI_DC hdc;
- UINT32 width;
- UINT32 height;
+ INT32 width;
+ INT32 height;
HGDI_BITMAP hBitmap = NULL;
if (!(hdc = gdi_GetDC()))
static int test_gdi_CreateRectRgn(void)
{
int rc = -1;
- UINT32 x1 = 32;
- UINT32 y1 = 64;
- UINT32 x2 = 128;
- UINT32 y2 = 256;
+ INT32 x1 = 32;
+ INT32 y1 = 64;
+ INT32 x2 = 128;
+ INT32 y2 = 256;
HGDI_RGN hRegion = gdi_CreateRectRgn(x1, y1, x2, y2);
if (!hRegion)
{
int rc = -1;
HGDI_RECT hRect;
- UINT32 x1 = 32;
- UINT32 y1 = 64;
- UINT32 x2 = 128;
- UINT32 y2 = 256;
+ INT32 x1 = 32;
+ INT32 y1 = 64;
+ INT32 x2 = 128;
+ INT32 y2 = 256;
if (!(hRect = gdi_CreateRect(x1, y1, x2, y2)))
{
surfaceRect.right = surface->x + surface->w;
surfaceRect.bottom = surface->y + surface->h;
update->BeginPaint(gdi->context);
+
+ if ((gdi->width < 0) || (gdi->height < 0))
+ return FALSE;
+ else
{
const UINT32 nXSrc = surface->x;
const UINT32 nYSrc = surface->y;
const UINT32 nXDst = nXSrc;
const UINT32 nYDst = nYSrc;
- const UINT32 width = (surface->w + surface->x < gdi->width) ? surface->w : gdi->width - surface->x;
- const UINT32 height = (surface->h + surface->y < gdi->height) ? surface->h : gdi->height -
+ const UINT32 width = (surface->w + surface->x < (UINT32)gdi->width) ? surface->w : (UINT32)gdi->width - surface->x;
+ const UINT32 height = (surface->h + surface->y < (UINT32)gdi->height) ? surface->h : (UINT32)gdi->height -
surface->y;
if (!freerdp_image_copy(gdi->primary_buffer, gdi->primary->hdc->format,
nXDst, nYDst, width, height,
surface->data, gdi->primary->hdc->format,
gdiSurface->scanline, 0, 0, NULL, FREERDP_FLIP_NONE))
- return CHANNEL_RC_NULL_DATA;
+ return FALSE;
- gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, width, height);
+ if ((nXDst > INT32_MAX) || (nYDst > INT32_MAX) || (width > INT32_MAX) || (height > INT32_MAX))
+ return FALSE;
+ gdi_InvalidateRegion(gdi->primary->hdc, (INT32)nXDst, (INT32)nYDst, (INT32)width, (INT32)height);
}
update->EndPaint(gdi->context);
return TRUE;