[vlc-commits] demux: libmp4: fix reading SmDm/CoLL

Francois Cartegnie git at videolan.org
Tue Aug 21 20:02:26 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Aug 21 18:57:26 2018 +0200| [3e2d5c34e5f797aa6bc2f9fdfac61ab21cd1849f] | committer: Francois Cartegnie

demux: libmp4: fix reading SmDm/CoLL

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

 modules/demux/mp4/libmp4.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 222376fea8..84159d1db1 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1915,8 +1915,17 @@ static int MP4_ReadBox_SmDm( stream_t *p_stream, MP4_Box_t *p_box )
     MP4_READBOX_ENTER( MP4_Box_data_SmDm_t, NULL );
     MP4_Box_data_SmDm_t *p_SmDm = p_box->data.p_SmDm;
 
+    uint8_t i_version;
+    uint32_t i_flags;
+    MP4_GET1BYTE( i_version );
+    MP4_GET3BYTES( i_flags );
+    VLC_UNUSED(i_flags);
+    if( i_version != 0 )
+        MP4_READBOX_EXIT( 0 );
+
+    const uint8_t RGB2GBR[3] = {2,0,1};
     for(int i=0; i<6; i++)
-        MP4_GET2BYTES( p_SmDm->primaries[i] );
+        MP4_GET2BYTES( p_SmDm->primaries[RGB2GBR[i/2] + i%2] );
     for(int i=0; i<2; i++)
         MP4_GET2BYTES( p_SmDm->white_point[i] );
     MP4_GET4BYTES( p_SmDm->i_luminanceMax );
@@ -1929,6 +1938,15 @@ static int MP4_ReadBox_CoLL( stream_t *p_stream, MP4_Box_t *p_box )
 {
     MP4_READBOX_ENTER( MP4_Box_data_CoLL_t, NULL );
     MP4_Box_data_CoLL_t *p_CoLL = p_box->data.p_CoLL;
+
+    uint8_t i_version;
+    uint32_t i_flags;
+    MP4_GET1BYTE( i_version );
+    MP4_GET3BYTES( i_flags );
+    VLC_UNUSED(i_flags);
+    if( i_version != 0 )
+        MP4_READBOX_EXIT( 0 );
+
     MP4_GET2BYTES( p_CoLL->i_maxCLL );
     MP4_GET2BYTES( p_CoLL->i_maxFALL );
     MP4_READBOX_EXIT( 1 );



More information about the vlc-commits mailing list