[MPlayer-dev-eng] [PATCH 2/2] libmpdemux/demux_mf: Don't crash if no paths were selected

Alexander Strasser eclipse7 at gmx.net
Fri May 14 23:28:21 EEST 2021


Committed.

  Alexander

On 2021-04-27 09:16 +0200, Alexander Strasser wrote:
> If open_mf in demux_open_mf returns an object with zero paths:
> Return directly without returning a demuxer object.
>
> Previously we segfaulted e.g. when trying to access the first
> path to guess its file type.
>
> Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
> ---
>  libmpdemux/demux_mf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c
> index 1f322cd41..68a51665f 100644
> --- a/libmpdemux/demux_mf.c
> +++ b/libmpdemux/demux_mf.c
> @@ -126,7 +126,7 @@ static demuxer_t* demux_open_mf(demuxer_t* demuxer){
>
>
>    mf=open_mf(demuxer->stream->url + 5);
> -  if(!mf) return NULL;
> +  if(!mf || mf->nr_of_files == 0) return NULL;
>
>    if(!mf_type){
>      char* p=strrchr(mf->names[0],'.');
> --


More information about the MPlayer-dev-eng mailing list