>From f646f955ea2e47d2aeb79e66f043f1a5039c6f35 Mon Sep 17 00:00:00 2001
From: Bruno Vasselle <bruno.vasse...@laposte.net>
Date: Thu, 24 Feb 2011 19:11:57 +0100
Subject: [PATCH] Division by zero in wcmInitArea when KEEP_SHAPE_FLAG is on.

Under some circumstances, wcmInitArea faces a division by zero when trying to 
deal with the "KeepShape" option. The patch disables KeepShape in the situation.

Signed-off-by: Bruno Vasselle <bruno.vasse...@laposte.net>
---
 src/xf86Wacom.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index e8c4710..5cdb300 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -116,6 +116,14 @@ static int wcmInitArea(InputInfoPtr pInfo)
        /* Maintain aspect ratio to the whole desktop
         * May need to consider a specific screen in multimonitor settings
         */
+       if ((priv->flags & KEEP_SHAPE_FLAG) &&
+           (priv->maxHeight == 0)) /* safeguard in case screen ratio is 
unknown */
+       {
+               xf86Msg(X_WARNING, 
+                       "%s: disabling option \"KeepShape\" as screen shape is 
not accessible\n",
+                       pInfo->name);
+               priv->flags &= ~KEEP_SHAPE_FLAG;
+       }
        if (priv->flags & KEEP_SHAPE_FLAG)
        {
 
-- 
1.7.4


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to