[FFmpeg-trac] #8408(undetermined:new): -vf unsharp=6 causes a segfault with ffmpeg and ffplay

FFmpeg trac at avcodec.org
Sun Dec 1 11:30:18 EET 2019


#8408: -vf unsharp=6 causes a segfault with ffmpeg and ffplay
-------------------------------------+-------------------------------------
             Reporter:  tjackson     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by mkver):

 Please test this patch:
 {{{
 diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
 index 95b4968d41..7b430b650d 100644
 --- a/libavfilter/vf_unsharp.c
 +++ b/libavfilter/vf_unsharp.c
 @@ -218,7 +218,7 @@ static int init_filter_param(AVFilterContext *ctx,
 UnsharpFilterParam *fp, const
             effect, effect_type, fp->msize_x, fp->msize_y, fp->amount /
 65535.0);

      fp->sr = av_malloc_array((MAX_MATRIX_SIZE - 1) * s->nb_threads,
 sizeof(uint32_t));
 -    fp->sc = av_malloc_array(2 * fp->steps_y * s->nb_threads,
 sizeof(uint32_t **));
 +    fp->sc = av_mallocz_array(2 * fp->steps_y * s->nb_threads,
 sizeof(uint32_t *));
      if (!fp->sr || !fp->sc)
          return AVERROR(ENOMEM);

 @@ -258,9 +258,11 @@ static void free_filter_param(UnsharpFilterParam *fp,
 int nb_threads)
  {
      int z;

 -    for (z = 0; z < 2 * fp->steps_y * nb_threads; z++)
 -        av_freep(&fp->sc[z]);
 -    av_freep(&fp->sc);
 +    if (fp->sc) {
 +        for (z = 0; z < 2 * fp->steps_y * nb_threads; z++)
 +            av_freep(&fp->sc[z]);
 +        av_freep(&fp->sc);
 +    }
      av_freep(&fp->sr);
  }
 }}}

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


More information about the FFmpeg-trac mailing list