[vlc-commits] demux/mkv: fix assert on infinite clusters

Filip Roséen git at videolan.org
Wed Oct 26 16:30:06 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Oct 22 04:54:08 2016 +0200| [4afffd36b54149b4129a63f08d961dc4981b4371] | committer: Thomas Guillem

demux/mkv: fix assert on infinite clusters

A cluster can have an infinite size, and if so the result of invoking
KaxCluster::GetEndPosition is undefined. These changes simply make
sure that we do not query clusters for their size, if they are not
finite in size.

fixes #17537

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=4afffd36b54149b4129a63f08d961dc4981b4371
---

 modules/demux/mkv/matroska_segment_seeker.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_seeker.cpp b/modules/demux/mkv/matroska_segment_seeker.cpp
index 73a2d16..dcab581 100644
--- a/modules/demux/mkv/matroska_segment_seeker.cpp
+++ b/modules/demux/mkv/matroska_segment_seeker.cpp
@@ -68,7 +68,9 @@ SegmentSeeker::add_cluster( KaxCluster * const p_cluster )
         /* fpos     */ p_cluster->GetElementPosition(),
         /* pts      */ mtime_t( p_cluster->GlobalTimecode() / INT64_C( 1000 ) ),
         /* duration */ mtime_t( -1 ),
-        /* size     */ p_cluster->GetEndPosition() - p_cluster->GetElementPosition()
+        /* size     */ p_cluster->IsFiniteSize()
+            ? p_cluster->GetEndPosition() - p_cluster->GetElementPosition()
+            : UINT64_MAX
     };
 
     add_cluster_position( cinfo.fpos );
@@ -425,7 +427,8 @@ SegmentSeeker::mkv_jump_to( matroska_segment_c& ms, fptr_t fpos )
         ms.ep->reconstruct( &ms.es, ms.segment, &ms.sys.demuxer );
     }
 
-    while( ms.cluster == NULL || ms.cluster->GetEndPosition() < fpos )
+    while( ms.cluster == NULL || (
+          ms.cluster->IsFiniteSize() && ms.cluster->GetEndPosition() < fpos ) )
     {
         if( !( ms.cluster = static_cast<KaxCluster*>( ms.ep->Get() ) ) )
         {



More information about the vlc-commits mailing list