diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2012-02-17 12:10:33 -0800 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2012-02-17 12:35:07 -0800 |
commit | 941fc1ea1ed7f7d99a8b9e2607b41f2f2820394a (patch) | |
tree | 4faacfc7aeb42bfbdba49fa6f7bce08e07118ed3 /libavcodec/cook.c | |
parent | e9b380a7a57bad9f872300ce61b5062a29c5242e (diff) | |
download | ffmpeg-941fc1ea1ed7f7d99a8b9e2607b41f2f2820394a.tar.gz |
cook: prevent div-by-zero if channels is zero.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Diffstat (limited to 'libavcodec/cook.c')
-rw-r--r-- | libavcodec/cook.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/cook.c b/libavcodec/cook.c index 8b6e116365..bc262f19b0 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -1078,6 +1078,10 @@ static av_cold int cook_decode_init(AVCodecContext *avctx) q->sample_rate = avctx->sample_rate; q->nb_channels = avctx->channels; q->bit_rate = avctx->bit_rate; + if (!q->nb_channels) { + av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); + return AVERROR_INVALIDDATA; + } /* Initialize RNG. */ av_lfg_init(&q->random_state, 0); |