[vlc-devel] [PATCH 1/5] demux/mp4: adjust to changes introduced by 8f9b76e

Filip Roséen filip at atch.se
Thu Nov 17 05:21:09 CET 2016


ExtractIntlStrings is only applicable for a limited range of boxes,
though with the recent changes following its introduction it might be
invoked for entities it is currently not protected from misdiagnosing.

These changes make sure that we only interpret a box inside the
function if:

 - the atom is known as a metadata box
 - the box has been parsed
 - the box has a father, and it is ATOM_udta

The check so that we do not parse boxes that contain a "data"-box has
been removed given that this check is more suitable at where the call
to the function is made.
---
 modules/demux/mp4/meta.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mp4/meta.c b/modules/demux/mp4/meta.c
index f22ebc1..ac9095f 100644
--- a/modules/demux/mp4/meta.c
+++ b/modules/demux/mp4/meta.c
@@ -239,10 +239,7 @@ static bool SetMeta( vlc_meta_t* p_meta, int i_type, char const* name, MP4_Box_t
 
 static int ExtractIntlStrings( vlc_meta_t *p_meta, MP4_Box_t *p_box )
 {
-    if( *(uint8_t*)&p_box->i_type != 0xa9 || MP4_BoxGet( p_box, "data" ) )
-        return false;
-
-    if( p_box->data.p_binary->p_blob == NULL )
+    if( MP4_BoxGet( p_box, "data" ) )
         return false;
 
     vlc_meta_type_t const* meta_type;
@@ -251,6 +248,14 @@ static int ExtractIntlStrings( vlc_meta_t *p_meta, MP4_Box_t *p_box )
     if( AtomXA9ToMeta( p_box->i_type, &meta_type, &meta_key ) == false )
         return false;
 
+    if( p_box->e_flags & BOX_FLAG_INCOMPLETE ||
+        p_box->p_father == NULL              ||
+        p_box->p_father->i_type != ATOM_udta ||
+        p_box->data.p_binary->p_blob == NULL )
+    {
+        return false;
+    }
+
     vlc_meta_t* p_meta_intl = vlc_meta_New();
 
     if( unlikely( !p_meta_intl ) )
-- 
2.10.2



More information about the vlc-devel mailing list