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

Michael Niedermayer michael at niedermayer.cc
Sun Jun 6 22:22:57 EEST 2021


On Sun, Jun 06, 2021 at 04:52:13PM +0200, Anton Khirnov wrote:
> 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?

ok will change it to that


> Or perhaps clip
> it from below rather than failing?

the video was 1x1 pixel, maybe i lack imagination but i see no usecase
for applying dctdnoiz to a 1x1 video

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210606/fd038899/attachment.sig>


More information about the ffmpeg-devel mailing list