Commit 8ad7d9ce authored by Filip Roséen's avatar Filip Roséen Committed by 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 f2756634.

fixes #17567
Signed-off-by: Steve Lhomme's avatarSteve Lhomme <robux4@videolabs.io>
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 55d4aff6
......@@ -687,7 +687,7 @@ bool matroska_segment_c::Preload( )
b_preloaded = true;
if( cluster == NULL || cluster->IsFiniteSize() )
if( cluster && cluster->IsFiniteSize() )
EnsureDuration();
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment