wmapro: prevent division by zero when sample rate is unspecified
authorSean McGovern <gseanmcg@gmail.com>
Thu, 2 Aug 2012 19:37:28 +0000 (15:37 -0400)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 3 Aug 2012 05:07:00 +0000 (07:07 +0200)
This fixes Bugzilla #327:

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
libavcodec/wmaprodec.c

index 30a43c8..699c1b7 100644 (file)
@@ -335,6 +335,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return AVERROR_INVALIDDATA;
     }
 
+    if (s->avctx->sample_rate <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     s->num_channels = avctx->channels;
 
     if (s->num_channels < 0) {