[FFmpeg-cvslog] wmapro: prevent division by zero when sample rate is unspecified

Sean McGovern git at videolan.org
Sat Aug 4 23:54:12 CEST 2012


ffmpeg | branch: master | Sean McGovern <gseanmcg at gmail.com> | Thu Aug  2 15:37:28 2012 -0400| [36936080239ba9e162f9f5d0f722ce579cb606cf] | committer: Ronald S. Bultje

wmapro: prevent division by zero when sample rate is unspecified

This fixes Bugzilla #327:

Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>

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

 libavcodec/wmaprodec.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 699c1b7..5fcafa2 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list