[vlc-commits] demux: mp4: fix reading elst

Francois Cartegnie git at videolan.org
Sat May 24 17:29:00 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat May 24 16:51:26 2014 +0200| [21c8fcc85ce0b84834ab123074a84964f9776d8b] | committer: Francois Cartegnie

demux: mp4: fix reading elst

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 329d21d..4cb0292 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2261,19 +2261,21 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
         MP4_READBOX_EXIT( 0 );
     }
 
-
-    for( unsigned i = 0; i < p_box->data.p_elst->i_entry_count; i++ )
+    unsigned i;
+    for( i = 0; i < p_box->data.p_elst->i_entry_count; i++ )
     {
         if( p_box->data.p_elst->i_version == 1 )
         {
-
+            if ( i_read < 20 )
+                break;
             MP4_GET8BYTES( p_box->data.p_elst->i_segment_duration[i] );
 
             MP4_GET8BYTES( p_box->data.p_elst->i_media_time[i] );
         }
         else
         {
-
+            if ( i_read < 12 )
+                break;
             MP4_GET4BYTES( p_box->data.p_elst->i_segment_duration[i] );
 
             MP4_GET4BYTES( p_box->data.p_elst->i_media_time[i] );
@@ -2283,7 +2285,8 @@ static int MP4_ReadBox_elst( stream_t *p_stream, MP4_Box_t *p_box )
         MP4_GET2BYTES( p_box->data.p_elst->i_media_rate_integer[i] );
         MP4_GET2BYTES( p_box->data.p_elst->i_media_rate_fraction[i] );
     }
-
+    if ( i < p_box->data.p_elst->i_entry_count )
+        p_box->data.p_elst->i_entry_count = i;
 #ifdef MP4_VERBOSE
     msg_Dbg( p_stream, "read box: \"elst\" entry-count %lu",
              (unsigned long)p_box->data.p_elst->i_entry_count );



More information about the vlc-commits mailing list