Commit b21182e83f for ffmpeg
commit b21182e83f9d4a2e0be67ab1c6b355f2aaf8695d
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Sep 24 22:01:45 2026 +0200
avcodec/cfhd: set the pixel format unconditionally
This is the pixel format counterpart of 056a4ae771.
Fixes: heap-buffer-overflow (write)
Fixes: A2S4stAxqn2e
Fixes: ANT-2026-8P9BWDVL-cfhd-threads2.avi
Fixes: ANT-2026-8P9BWDVL-cfhd-threads16.avi
Found-by: Claude and Ada Logics
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index e91788d4a8..28ec749cba 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -678,6 +678,7 @@ static int cfhd_decode(AVCodecContext *avctx, AVFrame *pic,
ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height);
if (ret < 0)
return ret;
+ avctx->pix_fmt = s->coded_format;
if (s->cropped_height) {
unsigned height = s->cropped_height << (avctx->pix_fmt == AV_PIX_FMT_BAYER_RGGB16);
if (avctx->height < height)