]> git.sesse.net Git - vlc/commitdiff
demux: mp4: meta != udta/meta
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 13 Apr 2014 09:33:19 +0000 (11:33 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sun, 13 Apr 2014 09:34:19 +0000 (11:34 +0200)
stop trying to read random atoms

modules/demux/mp4/libmp4.c

index fe94da062fa10e28139702f2cafb27b2e82da491..e4839f4c773d4e2d437d1d0aa7dce39a87144eed 100644 (file)
@@ -2854,13 +2854,33 @@ static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
     if( i_actually_read < 8 )
         return 0;
 
-    /* meta content starts with a 4 byte version/flags value (should be 0) */
-    i_actually_read = stream_Read( p_stream, meta_data, 4 );
-    if( i_actually_read < 4 )
+    if ( !p_box->p_father )
         return 0;
 
-    /* then it behaves like a container */
-    return MP4_ReadBoxContainerRaw( p_stream, p_box );
+    switch( p_box->p_father->i_type )
+    {
+    case ATOM_udta: /* itunes udta/meta */
+        /* meta content starts with a 4 byte version/flags value (should be 0) */
+        i_actually_read = stream_Read( p_stream, meta_data, 4 );
+        if( i_actually_read < 4 )
+            return 0;
+
+        /* then it behaves like a container */
+        return MP4_ReadBoxContainerRaw( p_stream, p_box );
+
+    default: /* regular meta atom */
+
+        i_actually_read = stream_Read( p_stream, meta_data, 8 );
+        if( i_actually_read < 8 )
+            return 0;
+
+        /* Mandatory */
+        if ( VLC_FOURCC( meta_data[4], meta_data[5], meta_data[6], meta_data[7] ) != ATOM_hdlr )
+            return 0;
+
+        //ft
+    }
+    return 1;
 }
 
 static int MP4_ReadBox_iods( stream_t *p_stream, MP4_Box_t *p_box )