[vlc-commits] demux: libmp4: reject truncated boxes (fix #17584)

Francois Cartegnie git at videolan.org
Fri Nov 4 11:08:31 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov  4 11:06:47 2016 +0100| [55d4aff67f9b74bc47c3258a9452fb8a5e17457b] | committer: Francois Cartegnie

demux: libmp4: reject truncated boxes (fix #17584)

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 5ea8f8a..e16a795 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -272,6 +272,12 @@ static MP4_Box_t *MP4_ReadBoxRestricted( stream_t *p_stream, MP4_Box_t *p_father
     {
         MP4_Seek( p_stream, i_next - 1 ); /*  since past seek can fail when hitting EOF */
         MP4_Seek( p_stream, i_next );
+        if( vlc_stream_Tell( p_stream ) < i_next - 1 ) /* Truncated box */
+        {
+            msg_Warn( p_stream, "truncated box %4.4s discarded", (char*) &peekbox.i_type );
+            MP4_BoxFree( p_box );
+            p_box = NULL;
+        }
     }
 
     if ( p_box )



More information about the vlc-commits mailing list