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

Steve Lhomme robux4 at gmail.com
Wed Nov 2 09:16:13 CET 2016


On Mon, Oct 31, 2016 at 1:05 AM, Filip Roséen <filip at atch.se> wrote:
> 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 if there was no clusters in the file.

The description of the fix seems logical but that's not what the code
does. I think EnsureDuration should keep the duration set to -1 if the
list of clusters is empty, it should not crash.

> 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 f2557a0..acb8a54 100644
> --- a/modules/demux/mkv/matroska_segment.cpp
> +++ b/modules/demux/mkv/matroska_segment.cpp
> @@ -686,7 +686,7 @@ bool matroska_segment_c::Preload( )
>
>      b_preloaded = true;
>
> -    if( cluster == NULL || cluster->IsFiniteSize() )
> +    if( cluster && cluster->IsFiniteSize() )
>          EnsureDuration();
>
>      return true;
> --
> 2.10.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list