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)
committerRonald S. Bultje <rsbultje@gmail.com>
Fri, 3 Aug 2012 19:04:47 +0000 (12:04 -0700)
This fixes Bugzilla #327:

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavcodec/wmaprodec.c

index 699c1b7503f880ecc0e1447489ea6c1c2308c925..5fcafa29a70acd4b596f0353f6ae53cb345a842c 100644 (file)
@@ -340,6 +340,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) {