[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 <contact@kcsoftwares.com>
Signed-off by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
This commit is contained in:
George Bișoc 2021-04-25 15:56:39 +02:00
parent 66f6abfc4a
commit ffea5152e6
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6

View file

@ -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)