1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

libfdk-aac: Check if cutoff value is valid

Passing a cutoff value < sample_rate/256 will cause a crash.
Also, values >20000 will have no effect and 20000 will be used anyway.

Signed-off-by: Mohammad Alsaleh <msal@tormail.org>
Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Mohammad Alsaleh 2012-07-15 19:41:11 +03:00 committed by Martin Storsjö
parent 9e4b04f8b9
commit c37c383e59

View File

@ -231,6 +231,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
}
if (avctx->cutoff > 0) {
if (avctx->cutoff < (avctx->sample_rate + 255) >> 8) {
av_log(avctx, AV_LOG_ERROR, "cutoff valid range is %d-20000\n",
(avctx->sample_rate + 255) >> 8);
goto error;
}
if ((err = aacEncoder_SetParam(s->handle, AACENC_BANDWIDTH,
avctx->cutoff)) != AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to set the encoder bandwith to %d: %s\n",