I made the mistake of setting this to zero and then bringing my
pen into proximity. Ooops. X crashed. Looks like mathematics
still can't handle getting the average of zero things ;)

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 Changes in v2:
 - Modified patch subject to better match 2nd change
 - Add lower and upper bounds checking into wcmParseOptions

 src/wcmValidateDevice.c |    6 ++++++
 src/wcmXCommand.c       |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 755d417..af6b8d2 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -539,6 +539,12 @@ int wcmParseOptions(InputInfoPtr pInfo, int hotplugged)
 
        common->wcmRawSample = xf86SetIntOption(pInfo->options, "RawSample",
                        common->wcmRawSample);
+       if (common->wcmRawSample < 1 || common->wcmRawSample > 
XWACOM_MAX_SAMPLES)
+       {
+               xf86Msg(X_ERROR, "%s: RawSample setting '%d' out of range 
[1..%d]. Using default.\n",
+                       pInfo->name, common->wcmRawSample, XWACOM_MAX_SAMPLES);
+               common->wcmRawSample = DEFAULT_SAMPLES;
+       }
 
        common->wcmSuppress = xf86SetIntOption(pInfo->options, "Suppress",
                        common->wcmSuppress);
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 4207dbe..e589e37 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -620,7 +620,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
                if ((values[0] < 0) || (values[0] > 100))
                        return BadValue;
 
-               if ((values[1] < 0) || (values[1] > XWACOM_MAX_SAMPLES))
+               if ((values[1] < 1) || (values[1] > XWACOM_MAX_SAMPLES))
                        return BadValue;
 
                if (!checkonly)
-- 
1.7.1


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to