[0.4.9][WIN32SS] Require at least the amount of extra memory, not exact amount

Fixes 3 application crashes:
CORE-15576 "Civilization II Multiplayer Gold Edition crashes when trying to open a map"
CORE-13924 "Click-n-type Virtual Keyboard 3.03.4012 from rapps crash when opening program preferences"
CORE-8790 "IceChat crashes with OutofMemory"

It regressed around SVN r56947, r56948, r56949.

cherry picked from commit 0.4.12-dev-417-g
e022d8d7cb
This commit is contained in:
Joachim Henze 2020-11-01 02:13:21 +01:00
parent 8377b4fd23
commit 2a9249b546
2 changed files with 3 additions and 3 deletions

View file

@ -86,7 +86,7 @@ IntGetSBData(PWND pwnd, INT Bar)
case SB_VERT:
return &pSBInfo->Vert;
case SB_CTL:
if ( pwnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) )
if ( pwnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)) )
{
ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar!\n");
return 0;

View file

@ -100,7 +100,7 @@ IntGetSBData(PWND pwnd, INT Bar)
case SB_VERT:
return &pSBInfo->Vert;
case SB_CTL:
if ( pwnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) )
if ( pwnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)) )
{
ERR("IntGetSBData Wrong Extra bytes for CTL Scrollbar!\n");
return 0;
@ -1186,7 +1186,7 @@ ScrollBarWndProc_common(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam
if (!pWnd->fnid)
{
TRACE("ScrollBar CTL size %d\n", (sizeof(SBWND)-sizeof(WND)));
if ( pWnd->cbwndExtra != (sizeof(SBWND)-sizeof(WND)) )
if ( pWnd->cbwndExtra < (sizeof(SBWND)-sizeof(WND)) )
{
ERR("Wrong Extra bytes for Scrollbar!\n");
return 0;