[PATCH] Xi: Remove redundant and incorrect butmap range check
Peter Hutterer
peter.hutterer at who-t.net
Mon Jun 22 22:58:53 PDT 2009
On Tue, Jun 23, 2009 at 09:23:30AM +1000, Peter Hutterer wrote:
> On Mon, Jun 22, 2009 at 08:59:45AM -0400, Ben Gamari wrote:
> > Maps are CARD8s, therefore checking for values above 255 is completely
> > unnecessary. Moreover, 0 is a valid value for maps, so the check wasn't
> > even correct to begin with. This fixes bug #22392, which was uncovered
> > by commit 280b7f92d729ec910ffa3d18dce7bbc215be7a3c.
> >
> > Signed-off-by: Ben Gamari <bgamari.foss at gmail.com>
> > ---
> > dix/inpututils.c | 6 ------
> > 1 files changed, 0 insertions(+), 6 deletions(-)
> >
> > diff --git a/dix/inpututils.c b/dix/inpututils.c
> > index 79b6ab7..8194e69 100644
> > --- a/dix/inpututils.c
> > +++ b/dix/inpututils.c
> > @@ -54,12 +54,6 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
> > for (i = 0; i < len; i++) {
> > if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1])
> > return MappingBusy;
> > -
> > - if (map[i] < 1 || map[i] > 255) {
> > - if (errval_out)
> > - *errval_out = map[i];
> > - return -1;
> > - }
> > }
> >
> > return Success;
> > --
> > 1.6.3.1
>
> Merged, thanks. I'll push this in a bit.
>
> I merged this patch not the other. errval_out should be used by this
> function. There are two spots where it may return BadDevice, in which case
> it should set the client error value to the deviceid.
> note that this cannot happen in the current implementation anyway since the
> parameters are already checked beforehand but it serves to be correct.
The patch below addresses the above issue.
>From 778b8352a322e755b078afa765fc41a4a31ec54c Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue, 23 Jun 2009 11:50:29 +1000
Subject: [PATCH] dix: set the client's error value to the bad deviceid in check_butmap_change.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/inpututils.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 8194e69..378deb0 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -45,11 +45,17 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
int i, ret;
if (!dev || !dev->button)
+ {
+ client->errorValue = (dev) ? dev->id : 0;
return BadDevice;
+ }
ret = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
if (ret != Success)
+ {
+ client->errorValue = dev->id;
return ret;
+ }
for (i = 0; i < len; i++) {
if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1])
--
1.6.3.rc1.2.g0164.dirty
More information about the xorg
mailing list