diff options
Diffstat (limited to 'dix/dispatch.c')
-rw-r--r-- | dix/dispatch.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c index 43cb4d1d3..2b6cb8287 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2029,6 +2029,14 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, if (!pWin->viewable) return BadMatch; + /* If the drawable is a window, the rectangle must be contained within + * its bounds (including the border). */ + if (x < -wBorderWidth(pWin) || + x + width > wBorderWidth(pWin) + (int)pDraw->width || + y < -wBorderWidth(pWin) || + y + height > wBorderWidth(pWin) + (int)pDraw->height) + return BadMatch; + relx += pDraw->x; rely += pDraw->y; |