summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-09-16 10:44:40 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-09-17 14:50:08 +1000
commitbdf6a6b2e2603142e62ae5968c65e6e26f57e51d (patch)
treed917ac79982f7713cdad515f5c75e75dd5bcd4d8
parent2dd60417450af4ac4f9938e09b06707dd91bddfb (diff)
Prohibit negative or zero x/y resolutions
Default resolution is 1, don't allow setting 0 to avoid divisions by 0 or just general weirdness. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> (cherry picked from commit 049611bd7f04e285909c55807478306cce83385f)
-rw-r--r--src/synaptics.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/synaptics.c b/src/synaptics.c
index 4b0fe2e..d5db457 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -769,6 +769,16 @@ set_default_parameters(InputInfoPtr pInfo)
xf86SetIntOption(opts, "HorizResolution", horizResolution);
pars->resolution_vert =
xf86SetIntOption(opts, "VertResolution", vertResolution);
+ if (pars->resolution_horiz <= 0) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Invalid X resolution, using 1 instead.\n");
+ pars->resolution_horiz = 1;
+ }
+ if (pars->resolution_vert <= 0) {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Invalid Y resolution, using 1 instead.\n");
+ pars->resolution_vert = 1;
+ }
/* Warn about (and fix) incorrectly configured TopEdge/BottomEdge parameters */
if (pars->top_edge > pars->bottom_edge) {