]> git.sesse.net Git - vlc/commitdiff
demux: libmp4: correctly read compressor name
authorFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 14 Jan 2015 17:55:31 +0000 (18:55 +0100)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Wed, 14 Jan 2015 17:55:31 +0000 (18:55 +0100)
modules/demux/mp4/libmp4.c
modules/demux/mp4/libmp4.h

index 03097c1ea7468499e142572bf44c56082113ebe9..629f53b136ab7c71c1f3e25e40767787a2590130 100644 (file)
@@ -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 );
index 6a646598b66ffd014f30b946762e47392aa3c7ed..d5111fdfdf7f0bdf895955788aa98b4c0c05675c 100644 (file)
@@ -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;