[FFmpeg-devel] [PATCH 2/5] avfilter/vf_dctdnoiz: Check threads

Anton Khirnov anton at khirnov.net
Sun Jun 6 17:52:13 EEST 2021


Quoting Michael Niedermayer (2021-06-06 15:47:54)
> Fixes: floating point division by 0
> Fixes: Ticket 8269
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavfilter/vf_dctdnoiz.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavfilter/vf_dctdnoiz.c b/libavfilter/vf_dctdnoiz.c
> index 63b1b29ea2..f09ab19c4d 100644
> --- a/libavfilter/vf_dctdnoiz.c
> +++ b/libavfilter/vf_dctdnoiz.c
> @@ -568,6 +568,9 @@ static int config_input(AVFilterLink *inlink)
>      av_log(ctx, AV_LOG_DEBUG, "threads: [max=%d hmax=%d user=%d] => %d\n",
>             MAX_THREADS, max_slice_h, ff_filter_get_nb_threads(ctx), s->nb_threads);
>  
> +    if (!s->nb_threads)
> +        return AVERROR(EINVAL);
> +

I presume the crash happens due to max_slice_h evaluating to 0. Wouldn't
it then make more sense to check max_slice_h directly? Or perhaps clip
it from below rather than failing?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list