https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ffea5152e607512f09efdb0bd02499e481877f59
commit ffea5152e607512f09efdb0bd02499e481877f59 Author: George Bișoc <[email protected]> AuthorDate: Sun Apr 25 15:56:39 2021 +0200 Commit: George Bișoc <[email protected]> CommitDate: Sun Apr 25 15:56:39 2021 +0200 [WIN32SS][NTUSER] Fix an integer underflow within scrollbar info setting 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 <[email protected]> Signed-off by: Hermès BÉLUSCA - MAÏTO <[email protected]> --- 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)
