summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2017-01-09 19:58:23 +0100
committerRui Matos <tiagomatos@gmail.com>2017-02-16 16:51:57 +0100
commit4d300db0e2434147d1058f7819251aed5cb1a5f1 (patch)
treef4426660408c6498279c6d8a29761d5a71dee7a4
parentb465546a52577722ac84815b35ad77e74ffa235c (diff)
downloadmutter-4d300db0e2434147d1058f7819251aed5cb1a5f1.tar.gz
wayland/keyboard: Avoid a division by zero
We don't further sanitize the values since the protocol allows for everything as long as it's non-negative. https://bugzilla.gnome.org/show_bug.cgi?id=776919
-rw-r--r--src/wayland/meta-wayland-keyboard.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c
index 4998cea4d..f8042dc65 100644
--- a/src/wayland/meta-wayland-keyboard.c
+++ b/src/wayland/meta-wayland-keyboard.c
@@ -514,7 +514,11 @@ notify_key_repeat_for_resource (MetaWaylandKeyboard *keyboard,
interval = g_settings_get_uint (keyboard->settings, "repeat-interval");
/* Our setting is in the milliseconds between keys. "rate" is the number
* of keys per second. */
- rate = (1000 / interval);
+ if (interval > 0)
+ rate = (1000 / interval);
+ else
+ rate = 0;
+
delay = g_settings_get_uint (keyboard->settings, "delay");
}
else