[PATCH synaptics] Don't allow for scroll distances of 0 (#49965)
Chase Douglas
chase.douglas at canonical.com
Thu May 17 07:07:43 PDT 2012
On 05/16/2012 08:30 PM, Peter Hutterer wrote:
> It'll either hang the server or blow up with divisions by 0, whichever one
> comes first.
>
> X.Org Bug 49965 <http://bugs.freedesktop.org/show_bug.cgi?id=49965>
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> src/properties.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/properties.c b/src/properties.c
> index 0cbca09..72ba896 100644
> --- a/src/properties.c
> +++ b/src/properties.c
> @@ -471,6 +471,9 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
> return BadMatch;
>
> dist = (INT32 *) prop->data;
> + if (dist[0] == 0 || dist[1] == 0)
> + return BadValue;
> +
> if (para->scroll_dist_vert != dist[0]) {
> para->scroll_dist_vert = dist[0];
> SetScrollValuator(dev, priv->scroll_axis_vert, SCROLL_TYPE_VERTICAL,
> @@ -589,6 +592,9 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
> return BadMatch;
>
> circdist = *(float *) prop->data;
> + if (circdist == 0)
> + return BadValue;
> +
> para->scroll_dist_circ = circdist;
> }
> else if (property == prop_circscroll_trigger) {
Makes sense.
Reviewed-by: Chase Douglas <chase.douglas at canonical.com>
More information about the xorg-devel
mailing list