[FFmpeg-cvslog] wmaenc: limit allowed sample rate to 48kHz

Justin Ruggles git at videolan.org
Mon Apr 2 01:45:20 CEST 2012


ffmpeg | branch: release/0.8 | Justin Ruggles <justin.ruggles at gmail.com> | Fri Mar  2 16:27:57 2012 -0500| [43e3e7764c498138c28507c5a7dfcd08c0748633] | committer: Reinhard Tartler

wmaenc: limit allowed sample rate to 48kHz

ff_wma_init() allows up to 50kHz, but this generates an exponent band
size table that requires 65 bands. The code assumes 25 bands in many
places, and using sample rates higher than 48kHz will lead to buffer
overwrites.

CC:libav-stable at libav.org
(cherry picked from commit 1ec075cfecac01f9a289965db06f76365b0b1737)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/wmaenc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 5f272f3..bf451aa 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -39,6 +39,12 @@ static int encode_init(AVCodecContext * avctx){
         return AVERROR(EINVAL);
     }
 
+    if (avctx->sample_rate > 48000) {
+        av_log(avctx, AV_LOG_ERROR, "sample rate is too high: %d > 48kHz",
+               avctx->sample_rate);
+        return AVERROR(EINVAL);
+    }
+
     if(avctx->bit_rate < 24*1000) {
         av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",
                avctx->bit_rate);



More information about the ffmpeg-cvslog mailing list