From 049611bd7f04e285909c55807478306cce83385f Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Sep 2014 10:44:40 +1000 Subject: 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 --- src/synaptics.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/synaptics.c b/src/synaptics.c index 8e6022a..2e3ad0c 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) { -- cgit v1.2.3