[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#681796: segmentation fault during suspend



tag 681796 + patch
thanks

On Sat, 28 Jul 2012, Julien Cristau wrote:

> It's helpful, yes, thanks.  Could you forward it upstream to
> https://bugs.freedesktop.org/enter_bug.cgi?product=xorg&component=Server/Input/Core

so upstream seems to boiled it down and provided a patch.  I have
adopted the patch for version in Debian 1.6.2 and attaching it here...
2nd day of a normal flight.


-- 
Yaroslav O. Halchenko
Postdoctoral Fellow,   Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        
Author: Peter Hutterer 
Subject: When disabling the device, reset num_active_touches to zero.

 Otherwise, num_active_touches stays at the value it was on DeviceOff().
 Future touches add to that value until the index may go past
 priv->open_slots[].  That causes spurious memory corruption on touch ends.

 And as of 55fc42e7c9b4948cadd4f98ef7b6a3b12e268e3e we ignore pre-existing
 touches anyway.

    Test-case:
    - place num_touches fingers on the touchpad
    - xinput disable <device>
    - lift fingers
    - xinput enable <device>
    - place finger on device, num_active_touches is now (num_touches + 1)

 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=52496
Bug-Debian: http://bugs.debian.org/681796
Last-Update: 2012-08-30

--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1153,6 +1153,7 @@ SynapticsReset(SynapticsPrivate * priv)
     priv->lastButtons = 0;
     priv->prev_z = 0;
     priv->prevFingers = 0;
+    priv->num_active_touches = 0;
 #ifdef HAVE_MULTITOUCH
     memset(priv->open_slots, 0, priv->num_slots * sizeof(int));
 #endif
@@ -3118,6 +3119,7 @@ UpdateTouchState(InputInfoPtr pInfo, str
         if (hw->slot_state[i] == SLOTSTATE_OPEN) {
             priv->open_slots[priv->num_active_touches] = i;
             priv->num_active_touches++;
+            BUG_WARN(priv->num_active_touches > priv->num_slots);
         }
         else if (hw->slot_state[i] == SLOTSTATE_CLOSE) {
             Bool found = FALSE;

Attachment: signature.asc
Description: Digital signature


Reply to: