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

Fixes: out of array access
Fixes: division by zero
Fixes: vdfZuLhrGLdR
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <[email protected]>



>From 12333b46f91b6557695d8089952f751c8cdb7b0f Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Tue, 15 Sep 2026 03:53:51 +0200
Subject: [PATCH] avfilter/vf_decimate: reject blocks smaller than one chroma
 sample

Fixes: out of array access
Fixes: division by zero
Fixes: vdfZuLhrGLdR
Found-by: zhang xingxing

Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavfilter/vf_decimate.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavfilter/vf_decimate.c b/libavfilter/vf_decimate.c
index 9fee8a1472..f552621d9e 100644
--- a/libavfilter/vf_decimate.c
+++ b/libavfilter/vf_decimate.c
@@ -393,6 +393,10 @@ static int config_output(AVFilterLink *outlink)
 
     dm->hsub      = pix_desc->log2_chroma_w;
     dm->vsub      = pix_desc->log2_chroma_h;
+    if (dm->chroma && ((dm->blockx / 2) >> dm->hsub == 0 || (dm->blocky / 2) 
>> dm->vsub == 0)) {
+        av_log(ctx, AV_LOG_ERROR, "blockx and blocky must be at least one 
chroma sample\n");
+        return AVERROR(EINVAL);
+    }
     dm->depth     = pix_desc->comp[0].depth;
     max_value     = (1 << dm->depth) - 1;
     dm->scthresh  = (int64_t)(((int64_t)max_value *          w * h          * 
dm->scthresh_flt)  / 100);
-- 
2.52.0

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

Reply via email to