projects
/
profile
/
ivi
/
weston.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
55b7cb2
)
simple-touch: fix off-by-one in position checks
author
Pekka Paalanen
<ppaalanen@gmail.com>
Tue, 31 Jul 2012 10:21:12 +0000
(13:21 +0300)
committer
Kristian Høgsberg
<krh@bitplanet.net>
Wed, 1 Aug 2012 02:27:23 +0000
(22:27 -0400)
Fix the off by one error in checking whether we can draw the marker
without exceeding buffer dimensions.
Fixes a segfault.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
clients/simple-touch.c
patch
|
blob
|
history
diff --git
a/clients/simple-touch.c
b/clients/simple-touch.c
index
3a1d940
..
f8afbb0
100644
(file)
--- a/
clients/simple-touch.c
+++ b/
clients/simple-touch.c
@@
-118,8
+118,8
@@
touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
else
c = 0xffffffff;
- if (x < 2 ||
touch->width - 2 < x
||
- y < 2 ||
touch->height - 2 < y
)
+ if (x < 2 ||
x >= touch->width - 2
||
+ y < 2 ||
y >= touch->height - 2
)
return;
p = (uint32_t *) touch->data + (x - 2) + (y - 2) * touch->width;