diff mbox series

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

Message ID 20210529155818.27398-2-michael@niedermayer.cc
State Accepted
Commit 36dead4bc28ca8aab13c61661f28c68bdefa5e9d
Headers show
Series [FFmpeg-devel,1/2] avcodec/aacenc: Do not divide by lambda_count if it is 0 | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer May 29, 2021, 3:58 p.m. UTC
Fixes: Ticket8011

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

Patch

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);