[PATCH] dix: fix crashers with floating device.

Jeremy Huddleston jeremyhu at apple.com
Mon Jun 6 21:58:23 PDT 2011


Looks right...

Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>

On Jun 6, 2011, at 9:01 PM, Peter Hutterer wrote:

> dc57f89959e549403f8488eb9f23425bd7118b22 accidentally reversed the
> conditions.
> 
> in dix/events.c we try to detach floating devices. This leads to a
> NULL-dereference on GetMaster()->id.
> 
> in dix/getevents.c we try to get the master device for the floating slave
> and dereference it.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> dix/events.c    |    2 +-
> dix/getevents.c |    4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/dix/events.c b/dix/events.c
> index 6660504..6b74b1a 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -1421,7 +1421,7 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
> static void
> DetachFromMaster(DeviceIntPtr dev)
> {
> -    if (!IsFloating(dev))
> +    if (IsFloating(dev))
>         return;
> 
>     dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
> diff --git a/dix/getevents.c b/dix/getevents.c
> index 1352a81..c935c97 100644
> --- a/dix/getevents.c
> +++ b/dix/getevents.c
> @@ -864,7 +864,7 @@ positionSprite(DeviceIntPtr dev, int mode,
>      * to the current screen. */
>     miPointerSetPosition(dev, mode, screenx, screeny);
> 
> -    if(!IsMaster(dev) || !IsFloating(dev)) {
> +    if(!IsMaster(dev) && !IsFloating(dev)) {
>         DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
>         master->last.valuators[0] = *screenx;
>         master->last.valuators[1] = *screeny;
> @@ -911,7 +911,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
>         return;
> 
>     updateMotionHistory(dev, ms, mask, dev->last.valuators);
> -    if(!IsMaster(dev) || !IsFloating(dev))
> +    if(!IsMaster(dev) && !IsFloating(dev))
>     {
>         DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
>         updateMotionHistory(master, ms, mask, dev->last.valuators);
> -- 
> 1.7.5.1
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 



More information about the xorg-devel mailing list