[vlc-devel] [PATCH 1/2] demux/mkv: fix 17567: null-pointer dereference in EnsureDuration

Filip Roséen filip at atch.se
Fri Nov 4 16:47:07 CET 2016


Since matroska_segment_c::EnsureDuration calculates the duration by
using the timecode of the last block in the last cluster, and
subtracting that with the timecode of the first cluster found, the
previous implementation would crash if there was no clusters in the
file.

These changes fixes that, and should be viewed as a fixup of f275663.

fixes #17567
---
 modules/demux/mkv/matroska_segment.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index ca5f34c..b2323d7 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -687,7 +687,7 @@ bool matroska_segment_c::Preload( )
 
     b_preloaded = true;
 
-    if( cluster == NULL || cluster->IsFiniteSize() )
+    if( cluster && cluster->IsFiniteSize() )
         EnsureDuration();
 
     return true;
-- 
2.10.2



More information about the vlc-devel mailing list