[vlc-commits] demux: mp4: enable WVC1 complex profile

Francois Cartegnie git at videolan.org
Tue Oct 27 19:13:53 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Oct 22 23:51:42 2015 +0200| [2ae1a2a240337d4d7d40971d567da5f627093f5d] | committer: Francois Cartegnie

demux: mp4: enable WVC1 complex profile

and fix write overflows

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

 modules/demux/mp4/libmp4.c |   28 +++++++---------------------
 modules/demux/mp4/libmp4.h |    2 +-
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 815d6aa..47945ef 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1861,33 +1861,19 @@ static int MP4_ReadBox_dac3( stream_t *p_stream, MP4_Box_t *p_box )
 
 static int MP4_ReadBox_dvc1( stream_t *p_stream, MP4_Box_t *p_box )
 {
-    MP4_Box_data_dvc1_t *p_dvc1;
-
     MP4_READBOX_ENTER( MP4_Box_data_dvc1_t, NULL );
-    p_dvc1 = p_box->data.p_dvc1;
-
-    MP4_GET1BYTE( p_dvc1->i_profile_level ); /* profile is on 4bits, level 3bits */
-    uint8_t i_profile = (p_dvc1->i_profile_level & 0xf0) >> 4;
-    if( i_profile != 0x06 && i_profile != 0x0c )
-    {
-        msg_Warn( p_stream, "unsupported VC-1 profile (%"PRIu8"), please report", i_profile );
+    if( i_read < 7 )
         MP4_READBOX_EXIT( 0 );
-    }
-
 
-    p_dvc1->i_vc1 = p_box->i_size - 7; /* Header + profile_level */
-
-    if( p_dvc1->i_vc1 > 0 )
-    {
-        uint8_t *p = p_dvc1->p_vc1 = malloc( p_dvc1->i_vc1 );
-        if( p )
-            memcpy( p, p_peek, i_read );
-    }
+    MP4_Box_data_dvc1_t *p_dvc1 = p_box->data.p_dvc1;
+    MP4_GET1BYTE( p_dvc1->i_profile_level );
+    p_dvc1->i_vc1 = i_read; /* Header + profile_level */
+    if( p_dvc1->i_vc1 > 0 && (p_dvc1->p_vc1 = malloc( p_dvc1->i_vc1 )) )
+        memcpy( p_dvc1->p_vc1, p_peek, i_read );
 
 #ifdef MP4_VERBOSE
     msg_Dbg( p_stream,
-             "read box: \"dvc1\" profile=%"PRIu8" level=%i",
-             i_profile, p_dvc1->i_profile_level & 0x0e >> 1 );
+             "read box: \"dvc1\" profile=%"PRIu8, (p_dvc1->i_profile_level & 0xf0) >> 4 );
 #endif
 
     MP4_READBOX_EXIT( 1 );
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 7cfd002..adb84a1 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -1235,7 +1235,7 @@ typedef struct
 {
     uint8_t i_profile_level;
 
-    int i_vc1;
+    uint32_t i_vc1;
     uint8_t *p_vc1;
 
 } MP4_Box_data_dvc1_t;



More information about the vlc-commits mailing list