mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-25 15:20:05 +01:00
xf86ScaleAxis: support for high resolution devices
High resolution devices was generating integer overflow.
For instance the wacom Cintiq 21UX has an axis value up to
87000. Thus the term (dSx * (Cx - Rxlow)) is greater than
MAX_INT32.
Using 64bits integer avoids such problem.
Signed-off-by: Philippe Ribet <ribet@cena.fr>
Signed-off-by: Benjamin Tissoires <tissoire@cena.fr>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit a780e5b363)
This commit is contained in:
parent
01bc98e313
commit
ee8664ee85
1 changed files with 4 additions and 4 deletions
|
|
@ -79,6 +79,7 @@
|
|||
#include "windowstr.h" /* screenIsSaved */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h> /* for int64_t */
|
||||
|
||||
#include <X11/Xpoll.h>
|
||||
|
||||
|
|
@ -978,12 +979,11 @@ xf86ScaleAxis(int Cx,
|
|||
int Rxlow )
|
||||
{
|
||||
int X;
|
||||
int dSx = Sxhigh - Sxlow;
|
||||
int dRx = Rxhigh - Rxlow;
|
||||
int64_t dSx = Sxhigh - Sxlow;
|
||||
int64_t dRx = Rxhigh - Rxlow;
|
||||
|
||||
dSx = Sxhigh - Sxlow;
|
||||
if (dRx) {
|
||||
X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
|
||||
X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow);
|
||||
}
|
||||
else {
|
||||
X = 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue