Commit c6ce8b9586 for ffmpeg
commit c6ce8b958617febd329d52da88796d0e38d442fc
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue Oct 6 23:31:55 2026 +0200
avformat/movenc: Reject AVIF output with any non-video stream
The check only failed when both streams were not video, a single
non-video stream or a non-video second stream were accepted.
Fixes: ugZ9hTL5EWJM
Missing stream type check Replicated through UnModified FFmpeg
Found during triage of the security report UwVT8CSrU4Oh
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f4284ded0a..2c349ef663 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -8396,7 +8396,7 @@ static int mov_init(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "AVIF output requires exactly one or two streams\n");
return AVERROR(EINVAL);
}
- if (s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO &&
+ if (s->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ||
(s->nb_streams > 1 && s->streams[1]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)) {
av_log(s, AV_LOG_ERROR, "AVIF output supports only video streams\n");
return AVERROR(EINVAL);