Commit 6fdfafa31a for ffmpeg
commit 6fdfafa31a535c5a6b50712ee85f59c0a7a02bd4
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue Oct 6 07:32:41 2026 +0200
avformat/movenc: Check the pixel format for AVIF output
Fixes: NULL pointer dereference
Fixes: UwVT8CSrU4Oh
Fixes: AISLE-2026-0111-00172
NULL pointer dereference Replicated through UnModified FFmpeg with ASAN,UBSAN
Found-by: Joshua Rogers <joshua.rogers@aisle.com>
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 7cdbf6bd59..f4284ded0a 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -8401,10 +8401,14 @@ static int mov_init(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "AVIF output supports only video streams\n");
return AVERROR(EINVAL);
}
+ if (!av_pix_fmt_desc_get(s->streams[0]->codecpar->format)) {
+ av_log(s, AV_LOG_ERROR, "AVIF output requires a known pixel format\n");
+ return AVERROR(EINVAL);
+ }
if (s->nb_streams > 1) {
const AVPixFmtDescriptor *pixdesc =
av_pix_fmt_desc_get(s->streams[1]->codecpar->format);
- if (pixdesc->nb_components != 1) {
+ if (!pixdesc || pixdesc->nb_components != 1) {
av_log(s, AV_LOG_ERROR, "Second stream for AVIF (alpha) output must have exactly one plane\n");
return AVERROR(EINVAL);
}