dix: move bounds check before access

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Simon Thum 2009-09-21 15:23:27 +02:00 committed by Peter Hutterer
parent 9edb9e9b4d
commit 824a09d856

View File

@ -578,12 +578,13 @@ GetMaximumEventsNum(void) {
static void
clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axis = pDev->valuator->axes + axisNum;
/* InitValuatoraAxisStruct ensures that (min < max). */
AxisInfoPtr axis;
if (axisNum >= pDev->valuator->numAxes)
return;
axis = pDev->valuator->axes + axisNum;
/* If a value range is defined, clip. If not, do nothing */
if (axis->max_value <= axis->min_value)
return;