tta: error out if samplerate is zero.
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 10 Feb 2012 18:51:43 +0000 (10:51 -0800)
committerRonald S. Bultje <rsbultje@gmail.com>
Sat, 11 Feb 2012 16:13:53 +0000 (08:13 -0800)
Prevents a division by zero later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
libavcodec/tta.c

index 853f6a2..28d0e9b 100644 (file)
@@ -223,6 +223,9 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
         if (s->channels == 0) {
             av_log(s->avctx, AV_LOG_ERROR, "Invalid number of channels\n");
             return AVERROR_INVALIDDATA;
+        } else if (avctx->sample_rate == 0) {
+            av_log(s->avctx, AV_LOG_ERROR, "Invalid samplerate\n");
+            return AVERROR_INVALIDDATA;
         }
 
         switch(s->bps) {