diff options
author | Joe Shaw <joeshaw@litl.com> | 2010-10-14 15:09:20 -0400 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-18 10:16:23 +1000 |
commit | e354ccac36a8ee3a23bdc845833c16a5646cc200 (patch) | |
tree | b8e4dfc406485bb5ee0bf759e635b9e376640cf9 /dix | |
parent | 424b856e8e19f35c24bfc0a9fced9464d2f17c90 (diff) |
fix a sign problem with valuator data.
Without this patch, any negative valuator value is wrong when returned
from XQueryDeviceState(). This is a regression from at least xserver
1.4.
Valuator data is set in dix/getevents.c:set_valuators() by copying
signed int values into an unsigned int field
DeviceEvent.valuators.data.
That data is converted into a double with an implicit cast by
assignment to axisVal[i] in Xi/exevents.c:UpdateDeviceState().
That double is converted back to a signed int in
queryst.c:ProcXQueryDeviceState(). If the original value in
set_valuators() is negative, the double value will be > 2^31 and the
conversion back to a signed int is undefined. (Although I
consistently see the value -2^31.)
Fix this by changing the definition of DeviceEvent.valuators.data from
uint32_t to int32_t.
Signed-off-by: Joe Shaw <joeshaw@litl.com>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/getevents.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index ecbf416b1..3731a4a38 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -210,7 +210,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, int first_valuator, } memcpy(&event->valuators.data[first_valuator], - valuators, num_valuators * sizeof(uint32_t)); + valuators, num_valuators * sizeof(int32_t)); } |