Commit 925486d86f for ffmpeg
commit 925486d86f3e10724c241279568f4fa181b8e38a
Author: Kacper Michajłow <kasper93@gmail.com>
Date: Mon Nov 30 16:02:03 2026 +0100
swresample: limit the used channel layout to SWR_CH_MAX channels
With a channel map the used channel layout gives the channel count of
the internal buffers and the width of the matrix, and both hold
SWR_CH_MAX channels.
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index b1e86af07e..10b076b38d 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -214,6 +214,8 @@ av_cold int swr_init(struct SwrContext *s){
if (!av_channel_layout_check(&s->used_ch_layout))
av_channel_layout_default(&s->used_ch_layout, s->in.ch_count);
+ if (swri_check_chlayout(s, &s->used_ch_layout, "used"))
+ return AVERROR(EINVAL);
if (s->used_ch_layout.nb_channels != s->in_ch_layout.nb_channels)
av_channel_layout_uninit(&s->in_ch_layout);