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

Backport of 24ad423d908cd595c983b6c503ddb0ee94901ba2 (master, PR #26081) to 
release/7.1.
This is CVE-2026-135736 (heap out-of-bounds access in vf_deband via the 
coupling command; in our ASAN run it shows as a heap-buffer-overflow, READ of 
size 1 in deband_8_coupling_c).

The bug is present in release/7.1: `process_command()` is identical to master 
before the fix and
`query_formats()` only restricts the format list when `coupling` is set at 
init, so enabling it at
runtime with a subsampled format makes the coupling path index the chroma 
planes with luma
dimensions. The patch applies without changes.

Debian marks trixie (7.1.x) as "postponed: wait until fixed in 7.1.x upstream 
branch", so a fix in
this branch would let distributions pick it up.

Tested on release/7.1 (2f5e4b9521), gcc 13 with ASAN, minimal build (deband, 
sendcmd, format, testsrc2):
`ffmpeg -f lavfi -i testsrc2=s=320x240:d=1 -vf "format=yuv420p,sendcmd=c='0.2 
deband coupling 1',deband" -f null -`
- without the patch: ASAN heap-buffer-overflow, READ of size 1 in 
deband_8_coupling_c (libavfilter/vf_deband.c:209)
- with the patch: the command is rejected with "coupling needs a pixel format 
without chroma subsampling", exit 0, no ASAN report
- control, same chain without the command and with `deband coupling 0`, without 
the patch: exit 0, no ASAN report

Prepared by an AI agent with the owner's permission.


>From f6f9a7d929c790ebac4fc0c56c703352db297435 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Sat, 14 Nov 2026 05:23:08 +0100
Subject: [PATCH] avfilter/vf_deband: reject the coupling command for
 subsampled formats

Fixes: out of array access
Fixes: QJKTLuAvDBVR
Fixes: AISLE-2026-0166-00123

Found-by: Joshua Rogers (AISLE)

Out of array read and write Replicated through UnModified FFmpeg with ASAN

(cherry picked from commit 24ad423d908cd595c983b6c503ddb0ee94901ba2)
Signed-off-by: SkillDMonkey <[email protected]>
---
 libavfilter/vf_deband.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavfilter/vf_deband.c b/libavfilter/vf_deband.c
index 5d508567628..ad69569cf23 100644
--- a/libavfilter/vf_deband.c
+++ b/libavfilter/vf_deband.c
@@ -435,11 +435,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 static int process_command(AVFilterContext *ctx, const char *cmd, const char 
*args,
                            char *res, int res_len, int flags)
 {
+    DebandContext *s = ctx->priv;
     int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
 
     if (ret < 0)
         return ret;
 
+    if (s->coupling && (s->shift[0] || s->shift[1])) {
+        av_log(ctx, AV_LOG_ERROR, "coupling needs a pixel format without 
chroma subsampling\n");
+        s->coupling = 0;
+        return AVERROR(EINVAL);
+    }
+
     return config_input(ctx->inputs[0]);
 }
 
-- 
2.54.1

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

Reply via email to