John Chadwick : wintab32: Use 64-bit math in ScaleForContext.

Alexandre Julliard julliard at winehq.org
Mon Nov 18 16:19:18 CST 2019


Module: wine
Branch: master
Commit: 27afc0d3ab728be671ce387263db3f50aeeb0821
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=27afc0d3ab728be671ce387263db3f50aeeb0821

Author: John Chadwick <john at jchw.io>
Date:   Sun Nov 17 14:26:40 2019 -0800

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 at jchw.io>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wintab32/context.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c
index 0514dd78b4..ff9a4ca677 100644
--- a/dlls/wintab32/context.c
+++ b/dlls/wintab32/context.c
@@ -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)
 {
     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
-        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)




More information about the wine-cvs mailing list