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

Sean McGovern git at videolan.org
Fri Aug 3 23:30:29 CEST 2012


ffmpeg | branch: master | Sean McGovern <gseanmcg at gmail.com> | Thu Aug  2 15:37:28 2012 -0400| [3680b2435101a5de56821718a71c828320d535a0] | committer: Kostya Shishkov

wmapro: prevent division by zero when sample rate is unspecified

This fixes Bugzilla #327:

Signed-off-by: Kostya Shishkov <kostya.shishkov at gmail.com>

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

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

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



More information about the ffmpeg-cvslog mailing list