diff --git a/modules/demux/mkv/stream_io_callback.cpp b/modules/demux/mkv/stream_io_callback.cpp index 5b539deb708b568dc4ae7848307cc74c5c5226f3..7af087182118601d3c4d20e2f770882491703676 100644 --- a/modules/demux/mkv/stream_io_callback.cpp +++ b/modules/demux/mkv/stream_io_callback.cpp @@ -47,6 +47,7 @@ uint32 vlc_stream_io_callback::read( void *p_buffer, size_t i_size ) void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode ) { int64_t i_pos, i_size; + int64_t i_current = stream_Tell( s ); switch( mode ) { @@ -57,10 +58,13 @@ void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode ) i_pos = stream_Size( s ) - i_offset; break; default: - i_pos= stream_Tell( s ) + i_offset; + i_pos= i_current + i_offset; break; } + if(i_pos == i_current) + return; + if( i_pos < 0 || ( ( i_size = stream_Size( s ) ) != 0 && i_pos >= i_size ) ) { mb_eof = true;