This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 254cebc4e8e1358ffcf7ba6fc13bcc4a98db80de
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Mon Oct 12 04:01:02 2026 +0200
Commit:     michaelni <[email protected]>
CommitDate: Tue Oct 20 02:25:09 2026 +0000

    avcodec/encode: reject video frames that do not match the encoder
    
    Fixes: out of array read
    Fixes: DdI1HfjoEG1l
    Found during triage of the review of 
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24765
    Out of array read Replicated through UnModified FFmpeg with ASAN
---
 libavcodec/encode.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index 6fbbe86d8f..fd503f01e1 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -518,6 +518,15 @@ static int encode_send_frame_internal(AVCodecContext 
*avctx, const AVFrame *src)
                 }
             }
         }
+    } else if (!(avctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE)) {
+        const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(src->format);
+
+        if (!(desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL) &&
+            (src->format != avctx->pix_fmt ||
+             src->width  < avctx->width  || src->height < avctx->height)) {
+            av_log(avctx, AV_LOG_ERROR, "Frame size or pixel format does not 
match the encoder\n");
+            return AVERROR(EINVAL);
+        }
     }
 
     ret = av_frame_ref(dst, src);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to