[vlc-commits] demux/mkv: fix 17572: error on cluster without timecode

Filip Roséen git at videolan.org
Wed Nov 2 09:20:00 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Oct 31 12:57:15 2016 +0100| [7f4fa0414e6421fef7ac884f7a28ef0bbc03e956] | committer: Thomas Guillem

demux/mkv: fix 17572: error on cluster without timecode

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

Signed-off-by: Steve Lhomme <robux4 at videolabs.io>
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 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 );
 



More information about the vlc-commits mailing list