isdv4ParseTouchPacket and usbChooseChannel return -1 on error

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/wcmISDV4.c | 3 ++-
 src/wcmUSB.c   | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
index da64598..95001a1 100644
--- a/src/wcmISDV4.c
+++ b/src/wcmISDV4.c
@@ -820,7 +820,8 @@ static int isdv4Parse(InputInfoPtr pInfo, const unsigned 
char* data, int len)
                channel = isdv4ParsePenPacket(pInfo, data, len, ds);
        else { /* a touch */
                channel = isdv4ParseTouchPacket(pInfo, data, len, ds);
-               ds = &common->wcmChannel[channel].work;
+               if (channel >= 0)
+                       ds = &common->wcmChannel[channel].work;
        }
 
        if (channel < 0)
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index bac3c66..f0951d4 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1259,6 +1259,8 @@ static void usbParseAbsMTEvent(WacomCommonPtr common, 
struct input_event *event)
                        if (event->value >= 0) {
                                int serial = event->value + 1;
                                private->wcmMTChannel = 
usbChooseChannel(common, TOUCH_ID, serial);
+                               if (private->wcmMTChannel < 0)
+                                       return;
                                ds = 
&common->wcmChannel[private->wcmMTChannel].work;
                                ds->serial_num = serial;
                        }
-- 
2.1.0


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to