[FFmpeg-cvslog] libfdk-aac: Check if cutoff value is valid

Mohammad Alsaleh git at videolan.org
Mon Jul 16 20:51:10 CEST 2012


ffmpeg | branch: master | Mohammad Alsaleh <msal at tormail.org> | Sun Jul 15 19:41:11 2012 +0300| [c37c383e595eac67d174e6ac596d6deba8c7cfd6] | committer: Martin Storsjö

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 at tormail.org>
Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavcodec/libfdk-aacenc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index b2bfad2..f2c3fbd 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",



More information about the ffmpeg-cvslog mailing list