On Wed, 14 Apr 2010 17:27:51 +0200, Benjamin Tissoires <[email protected]> wrote: > 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 <[email protected]> > Signed-off-by: Benjamin Tissoires <[email protected]>
Reviewed-by: Keith Packard <[email protected]> > int X; > - int dSx = Sxhigh - Sxlow; > - int dRx = Rxhigh - Rxlow; > + int64_t dSx = Sxhigh - Sxlow; > + int64_t dRx = Rxhigh - Rxlow; > > - dSx = Sxhigh - Sxlow; Was this value really computed twice before? Sigh. > if (dRx) { > - X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow; > + X = (int)(((dSx * (Cx - Rxlow)) / dRx) + Sxlow); -- [email protected]
pgpcFYLmxnKTk.pgp
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
