summaryrefslogtreecommitdiff
path: root/libavcodec/libfdk-aacenc.c
diff options
context:
space:
mode:
authorMohammad Alsaleh <msal@tormail.org>2012-07-15 19:41:11 +0300
committerMartin Storsjö <martin@martin.st>2012-07-15 21:59:51 +0300
commitc37c383e595eac67d174e6ac596d6deba8c7cfd6 (patch)
tree0c33a73fb54adcfa4e3bb97d56e23e8a9d8224d6 /libavcodec/libfdk-aacenc.c
parent9e4b04f8b9bce79adeb6f7784619a93d5682d509 (diff)
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>
Diffstat (limited to 'libavcodec/libfdk-aacenc.c')
-rw-r--r--libavcodec/libfdk-aacenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index b2bfad275e..f2c3fbdb73 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -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",