From c029122a8e8c6440d22d2d7292a95b837b33a895 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Wed, 23 Mar 2022 07:56:59 +0300 Subject: [PATCH] Avoid integer overflow when calculating working set size --- src/app/application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/application.cpp b/src/app/application.cpp index 84461b577..af9327958 100644 --- a/src/app/application.cpp +++ b/src/app/application.cpp @@ -799,7 +799,7 @@ void Application::shutdownCleanup(QSessionManager &manager) #ifdef Q_OS_WIN void Application::applyMemoryWorkingSetLimit() { - const int UNIT_SIZE = 1024 * 1024; // MiB + const SIZE_T UNIT_SIZE = 1024 * 1024; // MiB const SIZE_T maxSize = memoryWorkingSetLimit() * UNIT_SIZE; const SIZE_T minSize = std::min((64 * UNIT_SIZE), (maxSize / 2)); if (!::SetProcessWorkingSetSizeEx(::GetCurrentProcess(), minSize, maxSize, QUOTA_LIMITS_HARDWS_MAX_ENABLE))