[FFmpeg-devel] [PATCH 2/2] avcodec/aacpsy: Check bandwidth

Michael Niedermayer michael at niedermayer.cc
Sat May 29 18:58:18 EEST 2021


Fixes: Ticket8011

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/aacpsy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
index e51d29750b..487b84fd85 100644
--- a/libavcodec/aacpsy.c
+++ b/libavcodec/aacpsy.c
@@ -308,6 +308,9 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) {
     const int bandwidth    = ctx->cutoff ? ctx->cutoff : AAC_CUTOFF(ctx->avctx);
     const float num_bark   = calc_bark((float)bandwidth);
 
+    if (bandwidth <= 0)
+        return AVERROR(EINVAL);
+
     ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext));
     if (!ctx->model_priv_data)
         return AVERROR(ENOMEM);
-- 
2.17.1



More information about the ffmpeg-devel mailing list