diff options
author | Shitiz Garg <mail@dragooon.net> | 2011-12-17 19:35:59 +0530 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-03 19:07:30 +0100 |
commit | 1acf921d6f30dba14cec7f334feeeddd433e256a (patch) | |
tree | 603207955b0dba179189311cee4fa3127b8d85d3 | |
parent | 7bf3f79502e1721600021c0ed6b86f48140ac43a (diff) | |
download | ffmpeg-1acf921d6f30dba14cec7f334feeeddd433e256a.tar.gz |
adpcm: Check for channels to be a non-zero integer
channels would be 0 sometimes and would cause floating point exception
Fixes bugzilla #124
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit e614fac2e6e185a247d722d4e92368b3c3bc4bdb)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/adpcm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index cee1eed7bd..bbc7d1cd27 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -101,8 +101,9 @@ static av_cold int adpcm_decode_init(AVCodecContext * avctx) max_channels = 6; break; } - if(avctx->channels > max_channels){ - return -1; + if (avctx->channels <= 0 || avctx->channels > max_channels) { + av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); + return AVERROR(EINVAL); } switch(avctx->codec->id) { |