[FFmpeg-devel] [PATCH v4 11/11] avfilter/vf_dnn_detect: Fix null pointer dereference

Guo, Yejun yejun.guo at intel.com
Tue May 21 14:01:47 EEST 2024



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Andreas Rheinhardt
> Sent: Tuesday, May 21, 2024 3:12 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v4 11/11] avfilter/vf_dnn_detect: Fix null
> pointer dereference
> 
> Zhao Zhili:
> > From: Zhao Zhili <zhilizhao at tencent.com>
> >
> > Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> > ---
> >  libavfilter/vf_dnn_detect.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/libavfilter/vf_dnn_detect.c b/libavfilter/vf_dnn_detect.c
> > index b4eee06fe7..2a277d4169 100644
> > --- a/libavfilter/vf_dnn_detect.c
> > +++ b/libavfilter/vf_dnn_detect.c
> > @@ -807,11 +807,13 @@ static av_cold void
> dnn_detect_uninit(AVFilterContext *context)
> >      DnnDetectContext *ctx = context->priv;
> >      AVDetectionBBox *bbox;
> >      ff_dnn_uninit(&ctx->dnnctx);
> > -    while(av_fifo_can_read(ctx->bboxes_fifo)) {
> > -        av_fifo_read(ctx->bboxes_fifo, &bbox, 1);
> > -        av_freep(&bbox);
> > +    if (ctx->bboxes_fifo) {
> > +        while (av_fifo_can_read(ctx->bboxes_fifo)) {
> > +            av_fifo_read(ctx->bboxes_fifo, &bbox, 1);
> > +            av_freep(&bbox);
> > +        }
> > +        av_fifo_freep2(&ctx->bboxes_fifo);
> >      }
> > -    av_fifo_freep2(&ctx->bboxes_fifo);
> >      av_freep(&ctx->anchors);
> >      free_detect_labels(ctx);
> >  }
> 
> Please apply this patch soon; there is no need to wait for the other patches.
> (I independently stumbled upon this and sent a patch of my own.)
> 
> - Andreas
> 
This patch 11 pushed, thanks.


More information about the ffmpeg-devel mailing list