From 40934eb32088fcc037593823e9fce37371aee6ec Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Mon, 12 Oct 2020 17:42:11 +0200 Subject: [PATCH] demux: ts: check probe return count --- modules/demux/mpeg/ts.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c index 62569d859f..b529c75984 100644 --- a/modules/demux/mpeg/ts.c +++ b/modules/demux/mpeg/ts.c @@ -2157,10 +2157,12 @@ int ProbeStart( demux_t *p_demux, int i_program ) if( vlc_stream_Seek( p_sys->stream, i_pos ) ) return VLC_EGENERIC; - ProbeChunk( p_demux, i_program, false, &b_found ); + int i_count = ProbeChunk( p_demux, i_program, false, &b_found ); + if( i_count < PROBE_CHUNK_COUNT ) + break; /* Go ahead one more chunk if end of file contained only stuffing packets */ - i_probe_count += PROBE_CHUNK_COUNT; + i_probe_count += i_count; } while( i_pos < i_stream_size && !b_found && i_probe_count < PROBE_MAX ); @@ -2188,10 +2190,12 @@ int ProbeEnd( demux_t *p_demux, int i_program ) if( vlc_stream_Seek( p_sys->stream, i_pos ) ) return VLC_EGENERIC; - ProbeChunk( p_demux, i_program, true, &b_found ); + int i_count = ProbeChunk( p_demux, i_program, true, &b_found ); + if( i_count < PROBE_CHUNK_COUNT ) + break; /* Go ahead one more chunk if end of file contained only stuffing packets */ - i_probe_count += PROBE_CHUNK_COUNT; + i_probe_count += i_count; } while( i_pos > 0 && !b_found && i_probe_count < PROBE_MAX ); -- 2.11.4.GIT