* [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES
@ 2024-06-14 8:40 Michael Niedermayer
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
0 siblings, 2 replies; 3+ messages in thread
From: Michael Niedermayer @ 2024-06-14 8:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] avfilter/vf_deshake_opencl: Ensure that the first iteration initializes the best variables
2024-06-14 8:40 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES Michael Niedermayer
@ 2024-06-14 8:40 ` Michael Niedermayer
2024-07-21 13:52 ` [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2024-06-14 8:40 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Fixes: CID1452759 Uninitialized scalar variable
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavfilter/vf_deshake_opencl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavfilter/vf_deshake_opencl.c b/libavfilter/vf_deshake_opencl.c
index 96e21a069f2..5c3848c3ede 100644
--- a/libavfilter/vf_deshake_opencl.c
+++ b/libavfilter/vf_deshake_opencl.c
@@ -703,7 +703,7 @@ static int minimize_error(
total_err += deshake_ctx->ransac_err[j];
}
- if (total_err < best_err) {
+ if (i == 0 || total_err < best_err) {
for (int mi = 0; mi < 6; ++mi) {
best_model[mi] = model[mi];
}
--
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES
2024-06-14 8:40 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES Michael Niedermayer
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 ` Michael Niedermayer
1 sibling, 0 replies; 3+ messages in thread
From: Michael Niedermayer @ 2024-07-21 13:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 597 bytes --]
On Fri, Jun 14, 2024 at 10:40:27AM +0200, Michael Niedermayer wrote:
> 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(-)
will apply patchset
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Nations do behave wisely once they have exhausted all other alternatives.
-- Abba Eban
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-21 13:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-14 8:40 [FFmpeg-devel] [PATCH 1/2] avfilter/vf_deshake_opencl: Use AV_VIDEO_MAX_PLANES Michael Niedermayer
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
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