[vlc-devel] [PATCH] libmp4: minor bug fix

Frédéric Yhuel yhuelf at gmail.com
Mon Jan 21 22:58:10 CET 2013


If we read all the stream but n bytes, 0 < n < 8, there's no point to
try and read these n missing bytes.

If we try to continue the parsing, MP4_ReadBoxCommon() would return 0,
and VLC would fall back to avformat's demux while it is not necessary.
---
 modules/demux/mp4/libmp4.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 8979691..bcd0df8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3571,7 +3571,7 @@ MP4_Box_t *MP4_BoxGetRoot( stream_t *s )
         return p_root;
 
     p_root->i_size = stream_Size( s );
-    if( stream_Tell( s ) < stream_Size( s ) )
+    if( stream_Tell( s ) + 8 < stream_Size( s ) )
     {
         /* Get the rest of the file */
         i_result = MP4_ReadBoxContainerRaw( p_stream, p_root );
-- 
1.7.10.4



More information about the vlc-devel mailing list