Added some sanity checks on window dimensions.

This commit is contained in:
Alexandre Julliard 2004-12-09 16:58:00 +00:00
parent 50c1a6b959
commit 25b6493aee
3 changed files with 22 additions and 3 deletions

View File

@ -560,8 +560,11 @@ static LRESULT COMBO_Create( HWND hwnd, LPHEADCOMBO lphc, HWND hwndParent, LONG
if( CB_GETTYPE(lphc) == CBS_DROPDOWN ) if( CB_GETTYPE(lphc) == CBS_DROPDOWN )
lphc->droppedRect.left += COMBO_EDITBUTTONSPACE(); lphc->droppedRect.left += COMBO_EDITBUTTONSPACE();
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect); if (lphc->droppedRect.bottom < lphc->droppedRect.top)
ClientToScreen(hwnd, (LPPOINT)&lphc->droppedRect.right); lphc->droppedRect.bottom = lphc->droppedRect.top;
if (lphc->droppedRect.right < lphc->droppedRect.left)
lphc->droppedRect.right = lphc->droppedRect.left;
MapWindowPoints( hwnd, 0, (LPPOINT)&lphc->droppedRect, 2 );
} }
/* create listbox popup */ /* create listbox popup */

View File

@ -985,6 +985,16 @@ BOOL X11DRV_CreateWindow( HWND hwnd, CREATESTRUCTA *cs, BOOL unicode )
ERR( "invalid window height %d\n", cs->cy ); ERR( "invalid window height %d\n", cs->cy );
cs->cy = 65535; cs->cy = 65535;
} }
if (cs->cx < 0)
{
ERR( "invalid window width %d\n", cs->cx );
cs->cx = 0;
}
if (cs->cy < 0)
{
ERR( "invalid window height %d\n", cs->cy );
cs->cy = 0;
}
if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))) return FALSE; if (!(data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data)))) return FALSE;
data->whole_window = 0; data->whole_window = 0;

View File

@ -426,7 +426,13 @@ static UINT SWP_DoNCCalcSize( WINDOWPOS* pWinpos, const RECT* pNewWindowRect, RE
TRACE( "(%ld,%ld)-(%ld,%ld)\n", params.rgrc[0].left, params.rgrc[0].top, TRACE( "(%ld,%ld)-(%ld,%ld)\n", params.rgrc[0].left, params.rgrc[0].top,
params.rgrc[0].right, params.rgrc[0].bottom ); params.rgrc[0].right, params.rgrc[0].bottom );
/* If the application send back garbage, ignore it */ /* If the application sends back garbage, ignore it */
if (params.rgrc[0].left < pNewWindowRect->left) params.rgrc[0].left = pNewWindowRect->left;
if (params.rgrc[0].top < pNewWindowRect->top) params.rgrc[0].top = pNewWindowRect->top;
if (params.rgrc[0].right > pNewWindowRect->right) params.rgrc[0].right = pNewWindowRect->right;
if (params.rgrc[0].bottom > pNewWindowRect->bottom) params.rgrc[0].bottom = pNewWindowRect->bottom;
if (params.rgrc[0].left <= params.rgrc[0].right && if (params.rgrc[0].left <= params.rgrc[0].right &&
params.rgrc[0].top <= params.rgrc[0].bottom) params.rgrc[0].top <= params.rgrc[0].bottom)
*pNewClientRect = params.rgrc[0]; *pNewClientRect = params.rgrc[0];