summaryrefslogtreecommitdiff
path: root/libavcodec/adpcm.c
diff options
context:
space:
mode:
authorShitiz Garg <mail@dragooon.net>2011-12-17 19:35:59 +0530
committerJustin Ruggles <justin.ruggles@gmail.com>2011-12-17 09:44:19 -0500
commite614fac2e6e185a247d722d4e92368b3c3bc4bdb (patch)
tree72f7efcf46af003814483cff0252628f381bad4e /libavcodec/adpcm.c
parent4391805916a1557278351f25428d0145b1073520 (diff)
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>
Diffstat (limited to 'libavcodec/adpcm.c')
-rw-r--r--libavcodec/adpcm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 3ada328df3..48f44fe8dc 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) {