From 9d6e9c468b0ee758c7320e2017e6cca8998e2ba9 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 21 Dec 2010 16:06:36 +0000 Subject: [PATCH] Sometimes we get copy requests that are partially or fully outside the framebuffer. Not sure if this is a bug or not, but for now add some handling to deal with these gracefully. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4230 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/vncHooks.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/unix/xserver/hw/vnc/vncHooks.cc b/unix/xserver/hw/vnc/vncHooks.cc index 52ef42ae..1bf61a38 100644 --- a/unix/xserver/hw/vnc/vncHooks.cc +++ b/unix/xserver/hw/vnc/vncHooks.cc @@ -400,12 +400,19 @@ static void vncHooksCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, int dx, dy; RegionHelper copied(pScreen, pOldRegion); + BoxRec screen_box = {0, 0, pScreen->width, pScreen->height}; + RegionHelper screen_rgn(pScreen, &screen_box, 1); + dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; // RFB tracks copies in terms of destination rectangle, not source. // We also need to copy with changes to the Window's clipping region. + // Finally, make sure we don't get copies to or from regions outside + // the framebuffer. + REGION_INTERSECT(pScreen, copied.reg, copied.reg, screen_rgn.reg); REGION_TRANSLATE(pScreen, copied.reg, dx, dy); + REGION_INTERSECT(pScreen, copied.reg, copied.reg, screen_rgn.reg); REGION_INTERSECT(pScreen, copied.reg, copied.reg, &pWin->borderClip); (*pScreen->CopyWindow) (pWin, ptOldOrg, pOldRegion); -- 2.39.5