Commit 5cb9fcd211 for ffmpeg
commit 5cb9fcd21167cf2f5a2852ea582997bbd0055521
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Tue Oct 6 23:38:45 2026 +0200
avformat/mxfenc: Reject D-10 audio with more than 8 channels
The D-10 AES3 element has 8 channels (SMPTE 386M).
Fixes: invalid shift
Fixes: dAUa8TJu8sCA
Invalid shift Replicated through UnModified FFmpeg with UBSAN
Found during triage of the security report jQbdKiuH8zFh
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index f3a054d933..fd303ac750 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -3050,6 +3050,10 @@ static int mxf_init(AVFormatContext *s)
av_log(s, AV_LOG_ERROR, "MXF D-10 only support 16 or 24 bits le audio\n");
return AVERROR_PATCHWELCOME;
}
+ if (st->codecpar->ch_layout.nb_channels > 8) {
+ av_log(s, AV_LOG_ERROR, "MXF D-10 supports at most 8 audio channels\n");
+ return AVERROR(EINVAL);
+ }
sc->index = INDEX_D10_AUDIO;
sc->container_ul = ((MXFStreamContext*)s->streams[0]->priv_data)->container_ul;
sc->frame_size = 4 + 8 * av_rescale_rnd(st->codecpar->sample_rate, mxf->time_base.num, mxf->time_base.den, AV_ROUND_UP) * 4;