Module: libav Branch: release/0.8 Commit: cfd7d166e2ae68302329c059afa7c4778a70e9b5
Author: Ronald S. Bultje <[email protected]> Committer: Reinhard Tartler <[email protected]> Date: Fri Feb 17 12:10:33 2012 -0800 cook: prevent div-by-zero if channels is zero. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: [email protected] (cherry picked from commit 941fc1ea1ed7f7d99a8b9e2607b41f2f2820394a) Signed-off-by: Anton Khirnov <[email protected]> --- libavcodec/cook.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/libavcodec/cook.c b/libavcodec/cook.c index d2ed819..dc4c2ab 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); _______________________________________________ libav-commits mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-commits
