[vlc-devel] [PATCH 2/2] demux/mkv: fix 17572: error on cluster without timecode

Filip Roséen filip at atch.se
Mon Oct 31 12:57:15 CET 2016


As can be read in the MKV specification, a cluster must include a
timecode element in order to be valid.

These changes make sure that we error if such element is missing,
effectivelly preventing us from calling KaxCluster::GlobalTimecode
(which will assert if KaxCluster::InitTimecode has not been called).

fixes #17572
---
 modules/demux/mkv/matroska_segment_parse.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 5429b1f..50a8eb3 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -1228,16 +1228,25 @@ bool matroska_segment_c::ParseCluster( KaxCluster *cluster, bool b_update_start_
         return false;
     }
 
+    bool b_has_timecode = false;
+
     for( unsigned int i = 0; i < cluster->ListSize(); ++i )
     {
         if( MKV_CHECKED_PTR_DECL( p_ctc, KaxClusterTimecode, (*cluster)[i] ) )
         {
             cluster->InitTimecode( static_cast<uint64>( *p_ctc ), i_timescale );
             _seeker.add_cluster( cluster );
+            b_has_timecode = true;
             break;
         }
     }
 
+    if( !b_has_timecode )
+    {
+        msg_Err( &sys.demuxer, "Detected cluster without mandatory timecode" );
+        return false;
+    }
+
     if( b_update_start_time )
         i_mk_start_time = cluster->GlobalTimecode() / INT64_C( 1000 );
 
-- 
2.10.1



More information about the vlc-devel mailing list