From f7c454400ef612fd4458cf38391dec0cf03e6725 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 1 Apr 2010 16:57:14 -0500 Subject: [PATCH] winex11.drv: Clip rectangle values to 16-bit limits. The XRectangle type is sent through the X protocol as 16-bit values, so we have to do this to prevent them from being truncated. --- dlls/winex11.drv/graphics.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/dlls/winex11.drv/graphics.c b/dlls/winex11.drv/graphics.c index bc00e85..81e2b25 100644 --- a/dlls/winex11.drv/graphics.c +++ b/dlls/winex11.drv/graphics.c @@ -36,6 +36,7 @@ #define PI M_PI #endif #include +#include #include "windef.h" #include "winbase.h" @@ -131,10 +132,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) for (j = data->rdh.nCount-1; j >= 0; j--) { tmp = rect[j]; - xrect[j].x = tmp.left; - xrect[j].y = tmp.top; - xrect[j].width = tmp.right - tmp.left; - xrect[j].height = tmp.bottom - tmp.top; + xrect[j].x = max(min(tmp.left,SHRT_MAX),SHRT_MIN); + xrect[j].y = max(min(tmp.top,SHRT_MAX),SHRT_MIN); + xrect[j].width = min(tmp.right - tmp.left, USHRT_MAX); + xrect[j].height = min(tmp.bottom - tmp.top, USHRT_MAX); } } else @@ -142,10 +143,10 @@ RGNDATA *X11DRV_GetRegionData( HRGN hrgn, HDC hdc_lptodp ) for (i = 0; i < data->rdh.nCount; i++) { tmp = rect[i]; - xrect[i].x = tmp.left; - xrect[i].y = tmp.top; - xrect[i].width = tmp.right - tmp.left; - xrect[i].height = tmp.bottom - tmp.top; + xrect[i].x = max(min(tmp.left,SHRT_MAX),SHRT_MIN); + xrect[i].y = max(min(tmp.top,SHRT_MAX),SHRT_MIN); + xrect[i].width = min(tmp.right - tmp.left, USHRT_MAX); + xrect[i].height = min(tmp.bottom - tmp.top, USHRT_MAX); } } return data; -- 1.6.3.3