1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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@libav.org
This commit is contained in:
Justin Ruggles 2012-03-02 16:27:57 -05:00
parent c2b8dea182
commit 1ec075cfec

View File

@ -39,6 +39,12 @@ static int encode_init(AVCodecContext * avctx){
return AVERROR(EINVAL); 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) { if(avctx->bit_rate < 24*1000) {
av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n", av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",
avctx->bit_rate); avctx->bit_rate);