[FFmpeg-trac] #7140(avfilter:new): minterpolate filter does not work on huge video files

FFmpeg trac at avcodec.org
Fri Mar 27 01:22:20 EET 2020


#7140: minterpolate filter does not work on huge video files
--------------------------------------+------------------------------------
             Reporter:  kerchroot     |                    Owner:
                 Type:  enhancement   |                   Status:  new
             Priority:  wish          |                Component:  avfilter
              Version:  git-master    |               Resolution:
             Keywords:  minterpolate  |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+------------------------------------

Comment (by cehoyos):

 Please test the following inlined patch with `-max_alloc`
 {{{
 diff --git a/libavfilter/vf_minterpolate.c b/libavfilter/vf_minterpolate.c
 index b0bb238ade..d64f48a548 100644
 --- a/libavfilter/vf_minterpolate.c
 +++ b/libavfilter/vf_minterpolate.c
 @@ -361,9 +361,11 @@ static int config_input(AVFilterLink *inlink)
      }

      if (mi_ctx->mi_mode == MI_MODE_MCI) {
 -        mi_ctx->pixel_mvs = av_mallocz_array(width * height,
 sizeof(PixelMVS));
 -        mi_ctx->pixel_weights = av_mallocz_array(width * height,
 sizeof(PixelWeights));
 -        mi_ctx->pixel_refs = av_mallocz_array(width * height,
 sizeof(PixelRefs));
 +        if (width * height < SIZE_MAX / 4 / FFMAX3(sizeof(PixelMVS),
 sizeof(PixelWeights), sizeof(PixelRefs))) {
 +            mi_ctx->pixel_mvs = av_mallocz(width * height *
 sizeof(PixelMVS));
 +            mi_ctx->pixel_weights = av_mallocz(width * height *
 sizeof(PixelWeights));
 +            mi_ctx->pixel_refs = av_mallocz(width * height *
 sizeof(PixelRefs));
 +        }
          if (!mi_ctx->pixel_mvs || !mi_ctx->pixel_weights ||
 !mi_ctx->pixel_refs) {
              ret = AVERROR(ENOMEM);
              goto fail;
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7140#comment:7>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list