Module: wine Branch: master Commit: a4644f126b79c9501592b499ea8b9ed53767598c URL: http://source.winehq.org/git/wine.git/?a=commit;h=a4644f126b79c9501592b499ea...
Author: Alexandre Julliard julliard@winehq.org Date: Tue May 5 15:36:25 2009 +0200
winex11: Limit window dimensions to 65535 to avoid 16-bit truncation issues.
---
dlls/winex11.drv/window.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index 8eccfe1..56f99cb 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -334,7 +334,9 @@ static Window create_client_window( Display *display, struct x11drv_win_data *da mask = CWEventMask | CWBitGravity | CWWinGravity | CWBackingStore;
if ((cx = data->client_rect.right - data->client_rect.left) <= 0) cx = 1; + else if (cx > 65535) cx = 65535; if ((cy = data->client_rect.bottom - data->client_rect.top) <= 0) cy = 1; + else if (cy > 65535) cy = 65535;
wine_tsx11_lock();
@@ -711,11 +713,13 @@ static int get_window_changes( XWindowChanges *changes, const RECT *old, const R if (old->right - old->left != new->right - new->left ) { if ((changes->width = new->right - new->left) <= 0) changes->width = 1; + else if (changes->width > 65535) changes->width = 65535; mask |= CWWidth; } if (old->bottom - old->top != new->bottom - new->top) { if ((changes->height = new->bottom - new->top) <= 0) changes->height = 1; + else if (changes->height > 65535) changes->height = 65535; mask |= CWHeight; } if (old->left != new->left) @@ -1289,6 +1293,8 @@ static void sync_window_position( Display *display, struct x11drv_win_data *data changes.height = data->whole_rect.bottom - data->whole_rect.top; /* if window rect is empty force size to 1x1 */ if (changes.width <= 0 || changes.height <= 0) changes.width = changes.height = 1; + if (changes.width > 65535) changes.width = 65535; + if (changes.height > 65535) changes.height = 65535; mask |= CWWidth | CWHeight; }
@@ -1438,7 +1444,9 @@ static Window create_whole_window( Display *display, struct x11drv_win_data *dat DWORD layered_flags;
if (!(cx = data->window_rect.right - data->window_rect.left)) cx = 1; + else if (cx > 65535) cx = 65535; if (!(cy = data->window_rect.bottom - data->window_rect.top)) cy = 1; + else if (cy > 65535) cy = 65535;
if (!data->managed && is_window_managed( data->hwnd, SWP_NOACTIVATE, &data->window_rect )) {