[PATCH] dix/window: catch illegal window reconfiguration for composited windows.
Dave Airlie
airlied at gmail.com
Wed Jun 2 00:18:23 PDT 2010
From: Dave Airlie <airlied at redhat.com>
If a windows has been redirected, then it has to respect pixmap size limits,
32kx32k. This checks before resizing or changing border width if the window
is redirected and the pixmap size limits are being hit, and returns BadValue.
Reported in a RH Bugzilla.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
dix/window.c | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/dix/window.c b/dix/window.c
index 00854c6..f6ba740 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -2124,6 +2124,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
bw = pWin->borderWidth;
int rc, action, smode = Above;
xEvent event;
+ Bool reconfirm_valid_size = FALSE;
if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask))
return(BadMatch);
@@ -2164,6 +2165,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
client->errorValue = 0;
return BadValue;
}
+ reconfirm_valid_size = TRUE;
action = RESIZE_WIN;
}
tmask = mask & ~ChangeMask;
@@ -2175,6 +2177,7 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
{
case CWBorderWidth:
GET_CARD16(CWBorderWidth, bw);
+ reconfirm_valid_size = TRUE;
break;
case CWSibling:
sibwid = (Window ) *pVlist;
@@ -2208,9 +2211,20 @@ ConfigureWindow(WindowPtr pWin, Mask mask, XID *vlist, ClientPtr client)
if (!pParent)
return Success;
- /* Figure out if the window should be moved. Doesnt
- make the changes to the window if event sent */
+ if (reconfirm_valid_size) {
+#ifdef COMPOSITE
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ if (((w + (bw << 1)) > 32767) ||
+ ((h + (bw << 1)) > 32767)) {
+ client->errorValue = 0;
+ return BadValue;
+ }
+ }
+#endif
+ }
+ /* Figure out if the window should be moved. Doesnt
+ make the changes to the window if event sent */
if (mask & CWStackMode)
pSib = WhereDoIGoInTheStack(pWin, pSib, pParent->drawable.x + x,
pParent->drawable.y + y,
--
1.6.6.1
More information about the xorg-devel
mailing list