simple-touch: fix off-by-one in position checks
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>
This commit is contained in:
committed by
Kristian Høgsberg
parent
55b7cb24e0
commit
0768419393
@@ -118,8 +118,8 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
|
|||||||
else
|
else
|
||||||
c = 0xffffffff;
|
c = 0xffffffff;
|
||||||
|
|
||||||
if (x < 2 || touch->width - 2 < x ||
|
if (x < 2 || x >= touch->width - 2 ||
|
||||||
y < 2 || touch->height - 2 < y)
|
y < 2 || y >= touch->height - 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = (uint32_t *) touch->data + (x - 2) + (y - 2) * touch->width;
|
p = (uint32_t *) touch->data + (x - 2) + (y - 2) * touch->width;
|
||||||
|
|||||||
Reference in New Issue
Block a user