diff mbox series

[FFmpeg-devel,3/4] avcodec/g729postfilter: Limit shift in long term filter

Message ID 20230326222642.2489-3-michael@niedermayer.cc
State Accepted
Commit 6d1d8609ac1054017ea3d11b325ed94a1205e9fd
Headers show
Series [FFmpeg-devel,1/4] avcodec/wavarc: Fix several integer overflows | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer March 26, 2023, 10:26 p.m. UTC
Fixes: shift exponent 34 is too large for 32-bit type 'int'
Fixes: 57389/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6229522659016704

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/g729postfilter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavcodec/g729postfilter.c b/libavcodec/g729postfilter.c
index f3cacbac05b..26e937f0baf 100644
--- a/libavcodec/g729postfilter.c
+++ b/libavcodec/g729postfilter.c
@@ -353,7 +353,7 @@  static int16_t long_term_filter(AudioDSPContext *adsp, int pitch_delay_int,
         if (tmp > 0)
             L_temp0 >>= tmp;
         else
-            L_temp1 >>= -tmp;
+            L_temp1 >>= FFMIN(-tmp, 31);
 
         /* Check if longer filter increases the values of R'(k). */
         if (L_temp1 > L_temp0) {