composite: Fix use-after-free of the COW

CVE-2023-1393, ZDI-CAN-19866
pull/1/head
matthieu 2023-03-29 12:12:13 +00:00
parent 2c64aaa9d9
commit 1a68187e4c
1 changed files with 5 additions and 0 deletions

View File

@ -620,6 +620,11 @@ compDestroyWindow(WindowPtr pWin)
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = compDestroyWindow;
/* Did we just destroy the overlay window? */
if (pWin == cs->pOverlayWin)
cs->pOverlayWin = NULL;
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
return ret;
}