[PATCH] wintab32: Use 64-bit math in ScaleForContext.
John Chadwick
johnwchadwick at gmail.com
Sat Nov 16 02:43:21 CST 2019
With some tablet configurations, the InExt value passed to
ScaleForContext can be very large, leading to an integer overflow. Using
64-bit integers is a simple way to ensure that there is no overflow
without making the code more complicated.
---
dlls/wintab32/context.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wintab32/context.c b/dlls/wintab32/context.c
index 0514dd78b4..9050a12df5 100644
--- a/dlls/wintab32/context.c
+++ b/dlls/wintab32/context.c
@@ -175,7 +175,7 @@ int TABLET_PostTabletMessage(LPOPENCONTEXT
newcontext, UINT msg, WPARAM wParam,
return 0;
}
-static inline DWORD ScaleForContext(DWORD In, LONG InOrg, LONG InExt,
LONG OutOrg, LONG OutExt)
+static inline DWORD ScaleForContext(ULONGLONG In, LONGLONG InOrg,
LONGLONG InExt, LONGLONG OutOrg, LONGLONG OutExt)
{
if (((InExt > 0 )&&(OutExt > 0)) || ((InExt<0) && (OutExt < 0)))
return ((In - InOrg) * abs(OutExt) / abs(InExt)) + OutOrg;
--
2.23.0
More information about the wine-devel
mailing list