[vlc-commits] demux: libmp4: correctly read compressor name

Francois Cartegnie git at videolan.org
Wed Jan 14 20:25:20 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jan 14 18:55:31 2015 +0100| [88d2d861c067fbb95c68118b99d565587ac72e83] | committer: Francois Cartegnie

demux: libmp4: correctly read compressor name

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

 modules/demux/mp4/libmp4.c |   10 ++++++----
 modules/demux/mp4/libmp4.h |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 03097c1..629f53b 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -2135,9 +2135,10 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_GET4BYTES( p_box->data.p_sample_vide->i_qt_data_size );
     MP4_GET2BYTES( p_box->data.p_sample_vide->i_qt_frame_count );
 
-    if ( i_read < 32 )
+    if ( i_read < 32 || p_peek[0] > 31 ) // Pascal String
         MP4_READBOX_EXIT( 0 );
-    memcpy( &p_box->data.p_sample_vide->i_compressorname, p_peek, 32 );
+    memcpy( &p_box->data.p_sample_vide->sz_compressorname, &p_peek[1], p_peek[0] );
+    p_box->data.p_sample_vide->sz_compressorname[p_peek[0]] = 0;
     p_peek += 32; i_read -= 32;
 
     MP4_GET2BYTES( p_box->data.p_sample_vide->i_depth );
@@ -2156,10 +2157,11 @@ int MP4_ReadBox_sample_vide( stream_t *p_stream, MP4_Box_t *p_box )
     }
 
 #ifdef MP4_VERBOSE
-    msg_Dbg( p_stream, "read box: \"vide\" in stsd %dx%d depth %d",
+    msg_Dbg( p_stream, "read box: \"vide\" in stsd %dx%d depth %d (%s)",
                       p_box->data.p_sample_vide->i_width,
                       p_box->data.p_sample_vide->i_height,
-                      p_box->data.p_sample_vide->i_depth );
+                      p_box->data.p_sample_vide->i_depth,
+                      p_box->data.p_sample_vide->sz_compressorname );
 
 #endif
     MP4_READBOX_EXIT( 1 );
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 6a64659..d5111fd 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -608,7 +608,7 @@ typedef struct MP4_Box_data_sample_vide_s
     uint32_t i_qt_data_size;
     uint16_t i_qt_frame_count;
 
-    uint8_t  i_compressorname[32];
+    char     sz_compressorname[32];
     int16_t  i_depth;
 
     int16_t  i_qt_color_table;



More information about the vlc-commits mailing list