Commit 3972193f authored by diego's avatar diego

Prevent a division by 0 in the g726 decoder when the configured samplerate is 0.

patch by Laurent Aimar, fenrir via.ecp fr


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@15160 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 2b12b08f
......@@ -301,7 +301,14 @@ static int16_t g726_encode(G726Context* c, int16_t sig)
static av_cold int g726_init(AVCodecContext * avctx)
{
G726Context* c = avctx->priv_data;
unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;
unsigned int index;
if (avctx->sample_rate <= 0) {
av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n");
return -1;
}
index = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;
if (avctx->bit_rate % avctx->sample_rate && avctx->codec->encode) {
av_log(avctx, AV_LOG_ERROR, "Bitrate - Samplerate combination is invalid\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment