diff --git a/libavformat/iff.c b/libavformat/iff.c index 9402be48c9..4ff10beb38 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -284,7 +284,7 @@ static int parse_dsd_prop(AVFormatContext *s, AVStream *st, uint64_t eof) return AVERROR_INVALIDDATA; st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; st->codecpar->ch_layout.nb_channels = avio_rb16(pb); - if (size < 2 + st->codecpar->ch_layout.nb_channels * 4) + if (size < 2 + st->codecpar->ch_layout.nb_channels * 4 || !st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (st->codecpar->ch_layout.nb_channels > FF_ARRAY_ELEMS(dsd_layout)) { avpriv_request_sample(s, "channel layout");