Bugzilla – Attachment 193841 Details for
Bug 359899
array indices off by 1 in evdev input driver
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
[patch]
evdev-max-fixes.patch
evdev-max-fixes.patch (text/plain), 3.76 KB, created by
Marcus Meissner
on 2008-02-08 12:52:36 UTC
(
hide
)
Description:
evdev-max-fixes.patch
Filename:
MIME Type:
Creator:
Marcus Meissner
Created:
2008-02-08 12:52:36 UTC
Size:
3.76 KB
patch
obsolete
>--- xf86-input-evdev-1.1.5/src/evdev.h >+++ xf86-input-evdev-1.1.5/src/evdev.h >@@ -162,12 +162,12 @@ > > typedef struct { > int axes; >- int v[ABS_MAX]; >+ int v[ABS_MAX+1]; > int old_x, old_y; > int count; >- int min[ABS_MAX]; >- int max[ABS_MAX]; >- int map[ABS_MAX]; >+ int min[ABS_MAX+1]; >+ int max[ABS_MAX+1]; >+ int map[ABS_MAX+1]; > int scale[2]; > int screen; /* Screen number for this device. */ > Bool use_touch; >@@ -177,15 +177,15 @@ > > typedef struct { > int axes; >- int v[REL_MAX]; >+ int v[REL_MAX+1]; > int count; >- int map[REL_MAX]; >- int btnMap[REL_MAX][2]; >+ int map[REL_MAX+1]; >+ int btnMap[REL_MAX+1][2]; > } evdevRelRec, *evdevRelPtr; > > typedef struct { > int axes; >- int v[ABS_MAX]; >+ int v[ABS_MAX+1]; > } evdevAxesRec, *evdevAxesPtr; > > typedef struct { >--- xf86-input-evdev-1.1.5/src/evdev_axes.c >+++ xf86-input-evdev-1.1.5/src/evdev_axes.c >@@ -206,10 +206,10 @@ > axes->v[0x3c], axes->v[0x3d], axes->v[0x3e], axes->v[0x3f]); > > if (!skip_xy) >- for (i = 0; i < ABS_MAX; i++) >+ for (i = 0; i <= ABS_MAX; i++) > state->axes->v[i] = 0; > else if (skip_xy == 1) >- for (i = 2; i < ABS_MAX; i++) >+ for (i = 2; i <= ABS_MAX; i++) > state->axes->v[i] = 0; > else if (skip_xy == 2) > for (i = 0; i < 2; i++) >@@ -224,7 +224,7 @@ > struct input_absinfo absinfo; > int i; > >- for (i = 0; i < ABS_MAX; i++) { >+ for (i = 0; i <= ABS_MAX; i++) { > if (!test_bit (i, pEvdev->bits.abs)) > continue; > >@@ -288,7 +288,7 @@ > xf86XInputSetScreen (pInfo, state->abs->screen, conv_x, conv_y); > } > >- for (; i < ABS_MAX; i++) >+ for (; i <= ABS_MAX; i++) > state->axes->v[i] = state->abs->v[i]; > > EvdevAxesRealSyn (pInfo, 1, skip_xy); >@@ -306,7 +306,7 @@ > if (!state->axes || !state->rel || !state->rel->count) > return; > >- for (i = 0; i < REL_MAX; i++) { >+ for (i = 0; i <= REL_MAX; i++) { > if (rel->btnMap[i][0] || rel->btnMap[i][1]) { > if ((rel->v[i] > 0) && (btn = rel->btnMap[i][0])) > EvdevBtnPostFakeClicks (pInfo, btn, rel->v[i]); >@@ -343,7 +343,7 @@ > evdevStatePtr state = &pEvdev->state; > int map; > >- if (ev->code >= ABS_MAX) >+ if (ev->code > ABS_MAX) > return; > > /* FIXME: Handle inverted axes properly. */ >@@ -366,7 +366,7 @@ > evdevStatePtr state = &pEvdev->state; > int map; > >- if (ev->code >= REL_MAX) >+ if (ev->code > REL_MAX) > return; > > map = state->rel->map[ev->code]; >@@ -403,7 +403,7 @@ > int i, j, k = 0, real_axes; > > real_axes = 0; >- for (i = 0; i < ABS_MAX; i++) >+ for (i = 0; i <= ABS_MAX; i++) > if (test_bit (i, pEvdev->bits.abs)) > real_axes++; > >@@ -419,7 +419,7 @@ > pInfo->type_name = XI_MOUSE; > pInfo->conversion_proc = EvdevConvert; > >- for (i = 0, j = 0; i < ABS_MAX; i++) { >+ for (i = 0, j = 0; i <= ABS_MAX; i++) { > if (!test_bit (i, pEvdev->bits.abs)) > continue; > >@@ -444,7 +444,7 @@ > } > > state->abs->axes = real_axes; >- for (i = 0; i < ABS_MAX; i++) { >+ for (i = 0; i <= ABS_MAX; i++) { > if (state->abs->map[i] > state->abs->axes) > state->abs->axes = state->abs->map[i]; > } >@@ -525,7 +525,7 @@ > int i, j, k = 0, real_axes; > > real_axes = 0; >- for (i = 0; i < REL_MAX; i++) >+ for (i = 0; i <= REL_MAX; i++) > if (test_bit (i, pEvdev->bits.rel)) > real_axes++; > >@@ -542,7 +542,7 @@ > pInfo->type_name = XI_MOUSE; > pInfo->conversion_proc = EvdevConvert; > >- for (i = 0, j = 0; i < REL_MAX; i++) { >+ for (i = 0, j = 0; i <= REL_MAX; i++) { > if (!test_bit (i, pEvdev->bits.rel)) > continue; > >@@ -579,7 +579,7 @@ > } > > state->rel->axes = real_axes; >- for (i = 0; i < REL_MAX; i++) >+ for (i = 0; i <= REL_MAX; i++) > if (state->rel->map[i] > state->rel->axes) > state->rel->axes = state->rel->map[i]; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 359899
: 193841