[NTGDI] Prevent NULL pointer dereference in CLIPPING_UpdateGCRegion

This can happen, when the paged pool is full. This will probably cause drawing issues, but at least we don't crash (in this place).
This commit is contained in:
Timo Kreuzer 2024-09-05 13:17:18 +03:00
parent 299e4305ef
commit 9414fb6b59

View file

@ -11,6 +11,8 @@
#define NDEBUG
#include <debug.h>
DBG_DEFAULT_CHANNEL(GdiClipRgn);
VOID
FASTCALL
IntGdiReleaseRaoRgn(PDC pDC)
@ -776,16 +778,16 @@ CLIPPING_UpdateGCRegion(PDC pDC)
pDC->prgnAPI = NULL;
}
if (pDC->prgnRao)
REGION_Delete(pDC->prgnRao);
pDC->prgnRao = IntSysCreateRectpRgn(0,0,0,0);
ASSERT(pDC->prgnRao);
if (pDC->dclevel.prgnMeta || pDC->dclevel.prgnClip)
{
pDC->prgnAPI = IntSysCreateRectpRgn(0,0,0,0);
if (!pDC->prgnAPI)
{
/* Best we can do here. Better than crashing. */
ERR("Failed to allocate prgnAPI! Expect drawing issues!\n");
return;
}
if (!pDC->dclevel.prgnMeta)
{
REGION_bCopy(pDC->prgnAPI,
@ -804,6 +806,17 @@ CLIPPING_UpdateGCRegion(PDC pDC)
}
}
if (pDC->prgnRao)
REGION_Delete(pDC->prgnRao);
pDC->prgnRao = IntSysCreateRectpRgn(0,0,0,0);
if (!pDC->prgnRao)
{
/* Best we can do here. Better than crashing. */
ERR("Failed to allocate prgnRao! Expect drawing issues!\n");
return;
}
if (pDC->prgnAPI)
{
REGION_bIntersectRegion(pDC->prgnRao,