[FFmpeg-devel] [PATCH v4 11/11] avfilter/vf_dnn_detect: Fix null pointer dereference
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Tue May 21 10:11:40 EEST 2024
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
More information about the ffmpeg-devel
mailing list