[tslib] [PATCH v0 2/3] Remove out-of-bound tv access

Markus Burri markus.burri at mt.com
Mon Mar 27 07:59:07 PDT 2023


Since the if is out of the big loop, therefor i=max_slots and this is out-of-bound.
See struct memory allocation in main().

Signed-off-by: Markus Burri <markus.burri at mt.com>

Gbp-Pq: Name 0010-Remove-out-of-bound-tv-access.patch
---
 tools/ts_uinput.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ts_uinput.c b/tools/ts_uinput.c
index 9b54f18..0b9f554 100644
--- a/tools/ts_uinput.c
+++ b/tools/ts_uinput.c
@@ -339,8 +339,8 @@ static int send_touch_events(struct data_t *data, struct ts_sample_mt **s,
 		}
 
 		if (c > 0) {
-			data->ev[c].input_event_sec = s[j][i].tv.tv_sec;
-			data->ev[c].input_event_usec = s[j][i].tv.tv_usec;
+			data->ev[c].input_event_sec = data->ev[c-1].input_event_sec;
+			data->ev[c].input_event_usec = data->ev[c-1].input_event_usec;
 			data->ev[c].type = EV_SYN;
 			data->ev[c].code = SYN_REPORT;
 			data->ev[c].value = 0;
-- 
2.39.2




More information about the tslib mailing list