From 397c4d57c2ffec1aa29aed93061e2bc5ccae1cc8 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Mon, 27 Nov 2023 10:42:50 +0100 Subject: [PATCH] Fix signed integer overflow in handling WM_SIZE message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The width and height of WM_SIZE parameters in LPARAM are unsigned ints, but were extracted as signed ints with GET_X_LPARAM and GET_Y_LPARAM, leading to signed integer overflow when using big window sizes. The width and height are now extracted with LOWORD and HIWORD. Fixes: QTBUG-119424 Change-Id: Ie68716a08a686739b6464ce76319dc659fede336 Reviewed-by: Oliver Wolff Reviewed-by: Jøger Hansegård (cherry picked from commit 5aff671eea43c1c28990591a8e7d65af05496755) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 72a3ca15dcb..43de7e78584 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -1118,7 +1118,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, d->m_creationContext->applyToMinMaxInfo(reinterpret_cast(lParam)); return true; case QtWindows::ResizeEvent: - d->m_creationContext->obtainedSize = QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + d->m_creationContext->obtainedSize = QSize(LOWORD(lParam), HIWORD(lParam)); return true; case QtWindows::MoveEvent: d->m_creationContext->obtainedPos = QPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));