[vlc-commits] demux: mp4: don't seek out of range when size is known

Francois Cartegnie git at videolan.org
Fri Sep 30 10:42:50 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 30 10:34:12 2016 +0200| [d12f3d7091e28b022c9cd1698d2ccdbd876fcb3c] | committer: Francois Cartegnie

demux: mp4: don't seek out of range when size is known

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d12f3d7091e28b022c9cd1698d2ccdbd876fcb3c
---

 modules/demux/mp4/libmp4.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 809381c..e1afe4a 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -78,6 +78,11 @@ static int MP4_PeekBoxHeader( stream_t *p_stream, MP4_Box_t *p_box );
 
 static int MP4_Seek( stream_t *p_stream, uint64_t i_pos )
 {
+    /* Prevent prefetch breakage */
+    uint64_t i_size = stream_Size( p_stream );
+    if( i_size > 0 && i_pos >= i_size )
+        return VLC_EGENERIC;
+
     bool b_canseek = false;
     if ( vlc_stream_Control( p_stream, STREAM_CAN_SEEK, &b_canseek ) != VLC_SUCCESS ||
          b_canseek )



More information about the vlc-commits mailing list