From: RĂ©mi Denis-Courmont Date: Thu, 29 Jan 2015 17:15:53 +0000 (+0200) Subject: stream: handle seek across EOF correctly (hopefully) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6419254f5bb5ae06b72c93c9b52cd0a3bbbacb94;p=vlc stream: handle seek across EOF correctly (hopefully) --- diff --git a/src/input/stream.c b/src/input/stream.c index ba7bcee8a8..a5e3c22e81 100644 --- a/src/input/stream.c +++ b/src/input/stream.c @@ -1102,15 +1102,15 @@ static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int /* Be sure we will read something */ p_sys->stream.i_used += tk->i_start + p_sys->stream.i_offset + i_read - tk->i_end; } - if( AStreamRefillStream( s ) ) break; - } - - if( tk->i_end < tk->i_start + p_sys->stream.i_offset + i_read ) - { - i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset; + if( AStreamRefillStream( s ) ) + { + if( tk->i_end < tk->i_start + p_sys->stream.i_offset ) + return 0; /* EOF */ + i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset; + break; + } } - /* Now, direct pointer or a copy ? */ i_off = (tk->i_start + p_sys->stream.i_offset) % STREAM_CACHE_TRACK_SIZE; if( i_off + i_read <= STREAM_CACHE_TRACK_SIZE )