diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 85a5fe6ed4..47a55091b3 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -288,6 +288,11 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, return AVERROR(EINVAL); } + if (avctx->channels == 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); + return AVERROR(EINVAL); + } + n = avctx->channels * sample_size; if (n && buf_size % n) {