Commit a3b4878443 for ffmpeg
commit a3b48784438132fc33ce1ada84baf160439a2694
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed Nov 18 15:52:20 2026 +0100
avcodec/cfhd: reject the FrameIndex frame request when the context's dimensions or pixel format differ from the allocated buffers
Fixes: out of array write
Fixes: zPJ4SItf22cl
Fixes: ANT-2026-JP43PTUO
Found-by: Anthropic's OSS Scanner
Out of array write Replicated through UnModified FFmpeg with ASAN
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index 8033fac69d..f3a4ce820e 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -695,6 +695,13 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
s->coded_format = AV_PIX_FMT_NONE;
got_buffer = 1;
} else if (tag == FrameIndex && data == 1 && s->sample_type == 1 && s->frame_type == 2) {
+ if (avctx->coded_width != s->a_width ||
+ avctx->coded_height != s->a_height ||
+ avctx->pix_fmt != s->a_format) {
+ av_log(avctx, AV_LOG_ERROR, "Frame parameters do not match the allocated buffers\n");
+ ret = AVERROR_INVALIDDATA;
+ goto end;
+ }
pic->width = pic->height = 0;
if ((ret = ff_thread_get_buffer(avctx, pic, 0)) < 0)