[vlc-commits] demux/mkv: fix 17567: null-pointer dereference in EnsureDuration

Filip Roséen git at videolan.org
Fri Nov 4 17:11:47 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Nov  4 16:47:07 2016 +0100| [8ad7d9ceaf57149dfcd6903560007f354274f727] | committer: Thomas Guillem

demux/mkv: fix 17567: null-pointer dereference in EnsureDuration

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

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=8ad7d9ceaf57149dfcd6903560007f354274f727
---

 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;



More information about the vlc-commits mailing list