From a12f232865532533cfa6350fdaca1979aaceca77 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 19 May 2024 22:19:57 -0700 Subject: [PATCH] fix crash when odd monitor height (cherry picked from commit 7857c1e9acb67afbed81fac841d3c6acfac4f3f2) --- module/rdpCapture.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/module/rdpCapture.c b/module/rdpCapture.c index 5518a5e..7591af4 100644 --- a/module/rdpCapture.c +++ b/module/rdpCapture.c @@ -1281,13 +1281,21 @@ rdpCaptureGfxA2(rdpClientCon *clientCon, RegionPtr in_reg, BoxPtr *out_rects, while (index < num_rects) { rect = psrc_rects[index]; - LLOGLN(10, ("old x1 %d y1 %d x2 %d y2 %d", rect.x1, rect.x2, + LLOGLN(10, ("old x1 %d y1 %d x2 %d y2 %d", rect.x1, rect.y1, rect.x2, rect.y2)); rect.x1 -= rect.x1 & 1; rect.y1 -= rect.y1 & 1; rect.x2 += rect.x2 & 1; rect.y2 += rect.y2 & 1; - LLOGLN(10, ("new x1 %d y1 %d x2 %d y2 %d", rect.x1, rect.x2, + if (rect.x2 > id->width) + { + rect.x2 = id->width & ~1; + } + if (rect.y2 > id->height) + { + rect.y2 = id->height & ~1; + } + LLOGLN(10, ("new x1 %d y1 %d x2 %d y2 %d", rect.x1, rect.y1, rect.x2, rect.y2)); (*out_rects)[index] = rect; index++;