[PATCH libinput] Do not abort on invalid speed.
Olivier Fourdan
ofourdan at redhat.com
Wed Feb 4 01:34:25 PST 2015
Libinput's accelerator_set_speed() asserts the given speed value is
within the [-1.0, 1.0] range.
When using xf86-input-libinput, a client may try to set an invalid speed
which will cause the entire Xserver to abort.
Instead of aborting on invalid speed values, simply return a failure
(and log a message).
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
src/evdev.c | 5 ++++-
src/filter.c | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c
index 6e318dc..c96a66b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1194,8 +1194,11 @@ evdev_accel_config_set_speed(struct libinput_device *device, double speed)
{
struct evdev_device *dev = (struct evdev_device *)device;
- if (!filter_set_speed(dev->pointer.filter, speed))
+ if (!filter_set_speed(dev->pointer.filter, speed)) {
+ log_bug_libinput(device->seat->libinput,
+ "Invalid speed %f\n", speed);
return LIBINPUT_CONFIG_STATUS_INVALID;
+ }
return LIBINPUT_CONFIG_STATUS_SUCCESS;
}
diff --git a/src/filter.c b/src/filter.c
index 72ef760..91afdcd 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -260,7 +260,8 @@ accelerator_set_speed(struct motion_filter *filter,
struct pointer_accelerator *accel_filter =
(struct pointer_accelerator *)filter;
- assert(speed >= -1.0 && speed <= 1.0);
+ if (speed < -1.0 || speed > 1.0)
+ return false;
/* delay when accel kicks in */
accel_filter->threshold = DEFAULT_THRESHOLD - speed/6.0;
--
2.1.0
More information about the wayland-devel
mailing list