[FFmpeg-devel] [PATCH] avfilter/framepool: fix alignment requirements for audio and video filters

Paul B Mahol onemda at gmail.com
Mon Feb 21 13:34:50 EET 2022


On Mon, Feb 21, 2022 at 12:08 PM Anton Khirnov <anton at khirnov.net> wrote:

> Quoting Paul B Mahol (2022-02-20 19:07:47)
> > diff --git a/libavfilter/framepool.c b/libavfilter/framepool.c
> > index aab408d355..aaf1642b4f 100644
> > --- a/libavfilter/framepool.c
> > +++ b/libavfilter/framepool.c
> > @@ -76,15 +76,13 @@ FFFramePool *ff_frame_pool_video_init(AVBufferRef*
> (*alloc)(size_t size),
> >      }
> >
> >      if (!pool->linesize[0]) {
> > -        for(i = 1; i <= align; i += i) {
> > -            ret = av_image_fill_linesizes(pool->linesize, pool->format,
> > -                                          FFALIGN(pool->width, i));
> > -            if (ret < 0) {
> > -                goto fail;
> > -            }
> > -            if (!(pool->linesize[0] & (pool->align - 1)))
> > -                break;
> > +        ret = av_image_fill_linesizes(pool->linesize, pool->format,
> > +                                      FFALIGN(pool->width, align));
> > +        if (ret < 0) {
> > +            goto fail;
> >          }
> > +        if ((pool->linesize[0] & (pool->align - 1)))
>
> Check all of them, not just the first one.
>

Will do, it could overflow (among other things) in theory and result than
would not be wanted one.


>
> Otherwise looks good.
>
> --
> Anton Khirnov
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list