adpcm: fix division by zero in fate/creative/intro-partial.wav with -s 2 and -r 0...
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Dec 2011 13:55:23 +0000 (14:55 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Dec 2011 17:51:48 +0000 (18:51 +0100)
Bug-Found-by: Shitiz Garg
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/adpcm.c

index e305220..cee1eed 100644 (file)
@@ -340,6 +340,9 @@ static int get_nb_samples(AVCodecContext *avctx, const uint8_t *buf,
 
     *coded_samples = 0;
 
+    if(ch <= 0)
+        return 0;
+
     switch (avctx->codec->id) {
     /* constant, only check buf_size */
     case CODEC_ID_ADPCM_EA_XAS: