From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES
Date: Fri, 14 Jun 2024 10:40:27 +0200
Message-ID: <20240614084028.442499-1-michael@niedermayer.cc> (raw)
Fixes: CID1452758 Out-of-bounds read (actual out of bounds access depends on a frame with more than 3 planes)
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavfilter/vf_deshake_opencl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavfilter/vf_deshake_opencl.c b/libavfilter/vf_deshake_opencl.c
index e49c808a8e2..96e21a069f2 100644
--- a/libavfilter/vf_deshake_opencl.c
+++ b/libavfilter/vf_deshake_opencl.c
@@ -1387,8 +1387,8 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame)
size_t global_work[2];
int64_t duration;
cl_mem src, transformed, dst;
- cl_mem transforms[3];
- CropInfo crops[3];
+ cl_mem transforms[AV_VIDEO_MAX_PLANES];
+ CropInfo crops[AV_VIDEO_MAX_PLANES];
cl_event transform_event, crop_upscale_event;
DebugMatches debug_matches;
cl_int num_model_matches;
@@ -1518,7 +1518,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame)
transforms[0] = deshake_ctx->transform_y;
transforms[1] = transforms[2] = deshake_ctx->transform_uv;
- for (int p = 0; p < FF_ARRAY_ELEMS(transformed_frame->data); p++) {
+ for (int p = 0; p < AV_VIDEO_MAX_PLANES; p++) {
// Transform all of the planes appropriately
src = (cl_mem)input_frame->data[p];
transformed = (cl_mem)transformed_frame->data[p];
@@ -1619,7 +1619,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *input_frame)
crops[0] = deshake_ctx->crop_y;
crops[1] = crops[2] = deshake_ctx->crop_uv;
- for (int p = 0; p < FF_ARRAY_ELEMS(cropped_frame->data); p++) {
+ for (int p = 0; p < AV_VIDEO_MAX_PLANES; p++) {
// Crop all of the planes appropriately
dst = (cl_mem)cropped_frame->data[p];
transformed = (cl_mem)transformed_frame->data[p];
--
2.45.2
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-06-14 8:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 8:40 Michael Niedermayer [this message]
2024-06-14 8:40 ` [FFmpeg-devel] [PATCH 2/2] avfilter/vf_deshake_opencl: Ensure that the first iteration initializes the best variables Michael Niedermayer
2024-07-21 13:52 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES Michael Niedermayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240614084028.442499-1-michael@niedermayer.cc \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git