PR #24448 opened by Forgejo_Fairy
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24448
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24448.patch

The colorcorrect filter allocates two histogram buffers but does not release 
them in `uninit()` on release/5.0. Backport 5f87a68cf70da to free both buffers, 
preserving the original author.

Addresses the release/5.0 portion of #22776. This is equivalent to the 
reporter’s [submitted 
backport](https://patchwork.ffmpeg.org/project/ffmpeg/patch/[email protected]/);
 the upstream commit applies cleanly to base 64626725c36c. The release/6.0 
backport is tracked separately.

Validation: the submitted patch and this cherry-pick have identical stable 
patch IDs. The patched filter object compiled successfully on AArch64 with GCC 
13.3.0 using `./configure --disable-everything --disable-programs --disable-doc 
--disable-autodetect --enable-avfilter --enable-filter=colorcorrect` and `make 
-j8 libavfilter/vf_colorcorrect.o`. `git diff --check` passed. Runtime 
sanitizer validation is the reporter’s evidence in #22776; the security PoC was 
not independently executed in this investigation.


From 1a60a7f85b3cae0b1ea62e62220ded7facbd8324 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <[email protected]>
Date: Mon, 27 Nov 2023 12:08:20 +0100
Subject: [PATCH] avfilter/vf_colorcorrect: fix memory leaks

(cherry picked from commit 5f87a68cf70dafeab2fb89b42e41a4c29053b89b)

Assisted-by: Fairy
---
 libavfilter/vf_colorcorrect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavfilter/vf_colorcorrect.c b/libavfilter/vf_colorcorrect.c
index ee97b62b0e..ac2de2a357 100644
--- a/libavfilter/vf_colorcorrect.c
+++ b/libavfilter/vf_colorcorrect.c
@@ -498,6 +498,8 @@ static av_cold void uninit(AVFilterContext *ctx)
     ColorCorrectContext *s = ctx->priv;
 
     av_freep(&s->analyzeret);
+    av_freep(&s->uhistogram);
+    av_freep(&s->vhistogram);
 }
 
 static const AVFilterPad colorcorrect_inputs[] = {
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to