[libwacom/f17] Fix crash with WACf* serial devices (if not inputattach'd) (#819191)

Peter Hutterer whot at fedoraproject.org
Tue May 8 04:02:21 UTC 2012


commit d8b5169eacca026bd2603db1ee49b6f633bf0cdf
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue May 8 14:02:20 2012 +1000

    Fix crash with WACf* serial devices (if not inputattach'd) (#819191)

 0001-lib-fix-an-error-message.patch                |   28 ++++++++++++
 ...devices-may-end-up-with-a-NULL-product_st.patch |   45 ++++++++++++++++++++
 libwacom.spec                                      |    9 ++++-
 3 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/0001-lib-fix-an-error-message.patch b/0001-lib-fix-an-error-message.patch
new file mode 100644
index 0000000..6f88e28
--- /dev/null
+++ b/0001-lib-fix-an-error-message.patch
@@ -0,0 +1,28 @@
+From ee783c532efef4300360d0d84936650ab0091ef2 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Tue, 8 May 2012 13:55:17 +1000
+Subject: [PATCH] lib: fix an error message
+
+Leftover error message from when this was serial-only code.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ libwacom/libwacom.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
+index 821e3ee..359e945 100644
+--- a/libwacom/libwacom.c
++++ b/libwacom/libwacom.c
+@@ -229,7 +229,7 @@ get_device_info (const char   *path,
+ 
+ 		g_assert (product_str);
+ 		if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
+-			libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unimplemented serial bus");
++			libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
+ 			g_object_unref(parent);
+ 			goto bail;
+ 		}
+-- 
+1.7.10.1
+
diff --git a/0001-lib-serial-devices-may-end-up-with-a-NULL-product_st.patch b/0001-lib-serial-devices-may-end-up-with-a-NULL-product_st.patch
new file mode 100644
index 0000000..8b21b07
--- /dev/null
+++ b/0001-lib-serial-devices-may-end-up-with-a-NULL-product_st.patch
@@ -0,0 +1,45 @@
+From bbaec8323f2a6930c851d7ffe8461ce6a5280f4f Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Tue, 8 May 2012 13:57:00 +1000
+Subject: [PATCH] lib: serial devices may end up with a NULL product_str
+
+If not inputattached, the product_str is NULL and udev doesn't provide a way
+to query it. Assume it as 0 instead of crashing.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=819191
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ libwacom/libwacom.c |   16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
+index 359e945..482baa5 100644
+--- a/libwacom/libwacom.c
++++ b/libwacom/libwacom.c
+@@ -227,11 +227,17 @@ get_device_info (const char   *path,
+ 			g_object_unref (old_parent);
+ 		}
+ 
+-		g_assert (product_str);
+-		if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
+-			libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
+-			g_object_unref(parent);
+-			goto bail;
++		if (product_str) {
++			if (sscanf(product_str, "%d/%x/%x/%d", &garbage, vendor_id, product_id, &garbage) != 4) {
++				libwacom_error_set(error, WERROR_UNKNOWN_MODEL, "Unable to parse model identification");
++				g_object_unref(parent);
++				goto bail;
++			}
++		} else {
++			g_assert(*bus == WBUSTYPE_SERIAL);
++
++			*vendor_id = 0;
++			*product_id = 0;
+ 		}
+ 		if (parent)
+ 			g_object_unref (parent);
+-- 
+1.7.10.1
+
diff --git a/libwacom.spec b/libwacom.spec
index 4d38b91..1dd475b 100644
--- a/libwacom.spec
+++ b/libwacom.spec
@@ -1,6 +1,6 @@
 Name:           libwacom
 Version:        0.5
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Tablet Information Client Library
 Requires:       %{name}-data
 
@@ -14,6 +14,8 @@ Source1:        libwacom.rules
 Patch01:        0001-data-add-generic-eraser-to-Bamboo-Pen-Touch.patch
 Patch02:        0001-lib-Fix-generic-stylus-missing-an-eraser.patch
 Patch03:        0001-tools-add-missing-linker-flags-for-list-local-device.patch
+Patch04:        0001-lib-fix-an-error-message.patch
+Patch05:        0001-lib-serial-devices-may-end-up-with-a-NULL-product_st.patch
 
 BuildRequires:  autoconf automake libtool doxygen
 BuildRequires:  glib2-devel libgudev1-devel
@@ -43,6 +45,8 @@ Tablet information client library library data files.
 %patch01 -p1
 %patch02 -p1
 %patch03 -p1
+%patch04 -p1
+%patch05 -p1
 
 %build
 autoreconf --force -v --install || exit 1
@@ -84,6 +88,9 @@ rm -f %{buildroot}%{_libdir}/*.la
 %{_datadir}/libwacom/*.stylus
 
 %changelog
+* Tue May 08 2012 Peter Hutterer <peter.hutterer at redhat.com> 0.5-3
+- Fix crash with WACf* serial devices (if not inputattach'd) (#819191)
+
 * Thu May 03 2012 Peter Hutterer <peter.hutterer at redhat.com> 0.5-2
 - Fix gnome-control-center crash for Bamboo Pen & Touch
 - Generic styli needs to have erasers, default to two tools.


More information about the scm-commits mailing list