Check for int overflow in gdi_InvalidateRegion

This commit is contained in:
akallabeth 2020-04-07 08:28:11 +02:00 committed by akallabeth
parent 6c0aeb10d2
commit a9daba0190
1 changed files with 4 additions and 1 deletions

View File

@ -616,9 +616,12 @@ INLINE BOOL gdi_InvalidateRegion(HGDI_DC hdc, INT32 x, INT32 y, INT32 w, INT32 h
if ((hdc->hwnd->ninvalid + 1) > (INT64)hdc->hwnd->count)
{
int new_cnt;
size_t new_cnt;
HGDI_RGN new_rgn;
new_cnt = hdc->hwnd->count * 2;
if (new_cnt > UINT32_MAX)
return FALSE;
new_rgn = (HGDI_RGN)realloc(cinvalid, sizeof(GDI_RGN) * new_cnt);
if (!new_rgn)