Fix signed integer overflow in handling WM_SIZE message

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 <oliver.wolff@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 5aff671eea43c1c28990591a8e7d65af05496755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2023-11-27 10:42:50 +01:00 committed by Qt Cherry-pick Bot
parent 0361ff8939
commit 397c4d57c2

View File

@ -1118,7 +1118,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(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));