Commit bd3d2316c0 for ffmpeg
commit bd3d2316c0a4f1651561867fec7b53405f7022fe
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Wed Oct 7 00:05:30 2026 +0200
avformat/wavenc: Reject streams without channels
Invalid output Replicated through UnModified FFmpeg
Found during triage of the security report LHiad3FmdAmI
diff --git a/libavformat/wavenc.c b/libavformat/wavenc.c
index 9566850503..58624a0a4f 100644
--- a/libavformat/wavenc.c
+++ b/libavformat/wavenc.c
@@ -150,6 +150,11 @@ static av_cold int wav_init(AVFormatContext *s)
{
WAVMuxContext *wav = s->priv_data;
+ if (s->streams[0]->codecpar->ch_layout.nb_channels <= 0) {
+ av_log(s, AV_LOG_ERROR, "Invalid number of channels\n");
+ return AVERROR(EINVAL);
+ }
+
if (wav->write_peak == PEAK_ONLY) {
if (wav->rf64 == RF64_ALWAYS) {
av_log(s, AV_LOG_ERROR, "write_peak=only is not compatible with RF64\n");