wintab32: Use 64-bit math in ScaleForContext.

With some tablet configurations, the InExt value passed to
ScaleForContext can be very large, leading to an integer overflow.

Signed-off-by: John Chadwick <john@jchw.io>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
John Chadwick 2019-11-17 14:26:40 -08:00 committed by Alexandre Julliard
parent a45dfea99a
commit 27afc0d3ab
1 changed files with 2 additions and 2 deletions

View File

@ -178,9 +178,9 @@ int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
static inline DWORD ScaleForContext(DWORD In, LONG InOrg, LONG InExt, LONG OutOrg, LONG OutExt) static inline DWORD ScaleForContext(DWORD In, LONG InOrg, LONG InExt, LONG OutOrg, LONG OutExt)
{ {
if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0))) if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0)))
return ((In - InOrg) * abs(OutExt) / abs(InExt)) + OutOrg; return MulDiv(In - InOrg, abs(OutExt), abs(InExt)) + OutOrg;
else else
return ((abs(InExt) - (In - InOrg))*abs(OutExt) / abs(InExt)) + OutOrg; return MulDiv(abs(InExt) - (In - InOrg), abs(OutExt), abs(InExt)) + OutOrg;
} }
LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd) LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd)