Browse Source

cook: prevent div-by-zero if channels is zero.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 941fc1ea1e)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
tags/n0.10.1
Ronald S. Bultje Reinhard Tartler 14 years ago
parent
commit
cfd7d166e2
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      libavcodec/cook.c

+ 4
- 0
libavcodec/cook.c View File

@@ -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);


Loading…
Cancel
Save