[FFmpeg-cvslog] adpcm: Check for channels to be a non-zero integer

Shitiz Garg git at videolan.org
Sun Dec 18 03:12:21 CET 2011


ffmpeg | branch: master | Shitiz Garg <mail at dragooon.net> | Sat Dec 17 19:53:59 2011 +0530| [e614fac2e6e185a247d722d4e92368b3c3bc4bdb] | committer: Justin Ruggles

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e614fac2e6e185a247d722d4e92368b3c3bc4bdb
---

 libavcodec/adpcm.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 3ada328..48f44fe 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) {



More information about the ffmpeg-cvslog mailing list