From 34422024387ccb2fdbf7115e0ce6a8e68320d434 Mon Sep 17 00:00:00 2001 From: Petr N Date: Sat, 28 Dec 2019 19:19:00 +0100 Subject: [PATCH] Fix a bug in loop range --- dvb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dvb.c b/dvb.c index 9789a07..d8204cf 100644 --- a/dvb.c +++ b/dvb.c @@ -165,6 +165,7 @@ static void DVRRead(struct ev_loop *loop, struct ev_io *w, int revents) static int i_remaining = 0; static int offset = 0; int new_offset = 0; + int processed; if ( (i_len = read(i_dvr, buffer+i_remaining, MAX_READ_ONCE*TS_SIZE)) < 0 ) { @@ -209,7 +210,7 @@ static void DVRRead(struct ev_loop *loop, struct ev_io *w, int revents) msg_Err( NULL, "Drop %d bytes", offset); } - for ( i = offset; i < i_len; i += TS_SIZE ) + for ( i = offset; i <= i_len - TS_SIZE; i += TS_SIZE ) { if ( (*pp_current) == NULL ) *pp_current = block_New(); memcpy((*pp_current)->p_ts, buffer+i, TS_SIZE); -- 2.11.4.GIT