aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aacenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-05-28 21:37:26 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-06 13:54:16 +0200
commitc21762969e1e66870716d84c3ded81d866ab85b4 (patch)
treedf02d519d9f0865fb01ec5bf42ded92900bd61d3 /libavcodec/aacenc.c
parentc840ac7464af50895efd581ab5a90a883691d1f0 (diff)
downloadffmpeg-c21762969e1e66870716d84c3ded81d866ab85b4.tar.gz
avcodec/aacenc: Avoid 0 lambda
Fixes: Ticket8003 Fixes: CVE-2020-20453 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a7a7f32c8ad0179a1a85d0a8cff35924e6d90be8) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/aacenc.c')
-rw-r--r--libavcodec/aacenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 4d0abb107f..fb6229930f 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -28,6 +28,7 @@
* TODOs:
* add sane pulse detection
***********************************/
+#include <float.h>
#include "libavutil/libm.h"
#include "libavutil/thread.h"
@@ -855,7 +856,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
/* Not so fast though */
ratio = sqrtf(ratio);
}
- s->lambda = FFMIN(s->lambda * ratio, 65536.f);
+ s->lambda = av_clipf(s->lambda * ratio, FLT_MIN, 65536.f);
/* Keep iterating if we must reduce and lambda is in the sky */
if (ratio > 0.9f && ratio < 1.1f) {