win32ss/user/ntuser/winpos.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c index 7795f0293b6..4a602a49f89 100644 --- a/win32ss/user/ntuser/winpos.c +++ b/win32ss/user/ntuser/winpos.c @@ -999,6 +999,13 @@ co_WinPosGetMinMaxInfo(PWND Window, POINT* MaxSize, POINT* MaxPos, co_IntSendMessage(Window->head.h, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax); + /* Validate returned MinMax */ + if (MinMax.ptMaxTrackSize.x > 0) + MinMax.ptMaxTrackSize.x = min(MinMax.ptMaxTrackSize.x, UserGetSystemMetrics(SM_CXSCREEN)); + + if (MinMax.ptMaxTrackSize.y > 0) + MinMax.ptMaxTrackSize.y = min(MinMax.ptMaxTrackSize.y, UserGetSystemMetrics(SM_CYSCREEN)); + /* if the app didn't change the values, adapt them for the current monitor */ if ((monitor = UserGetPrimaryMonitor())) {