From ffea5152e607512f09efdb0bd02499e481877f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?George=20Bi=C8=99oc?= Date: Sun, 25 Apr 2021 15:56:39 +0200 Subject: [PATCH] [WIN32SS][NTUSER] Fix an integer underflow within scrollbar info setting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks goes to I_Kill_Bugs for the patch (and partly to Kyle Katarn for the PR) and Hermes for tweaking the patch code. Had to make a commit myself as the PR author's account is deleted. Signed-off by: I_Kill_Bugs (original patch author) Signed-off by: Kyle Katarn Signed-off by: Hermès BÉLUSCA - MAÏTO --- win32ss/user/ntuser/scrollbar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/user/ntuser/scrollbar.c b/win32ss/user/ntuser/scrollbar.c index ece40873a49..75d499b25e6 100644 --- a/win32ss/user/ntuser/scrollbar.c +++ b/win32ss/user/ntuser/scrollbar.c @@ -597,7 +597,7 @@ co_IntSetScrollInfo(PWND Window, INT nBar, LPCSCROLLINFO lpsi, BOOL bRedraw) if (lpsi->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL)) { new_flags = Window->pSBInfo->WSBflags; - if (Info->nMin >= (int)(Info->nMax - max(Info->nPage - 1, 0))) + if (Info->nMin + (int)max(Info->nPage, 1) > Info->nMax) { /* Hide or disable scroll-bar */ if (lpsi->fMask & SIF_DISABLENOSCROLL)