diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2023-09-07 02:13:13 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-09-22 23:47:40 +0200 |
commit | 6580a7b2b27973947118482235a2eb1214d968a2 (patch) | |
tree | 7c1aa5ea57e37fa1005399b95b499bd2790acd62 /libavcodec/celp_math.h | |
parent | f1954ff8d13b7d72cbdfe9515b7ae130d65bc2b0 (diff) | |
download | ffmpeg-6580a7b2b27973947118482235a2eb1214d968a2.tar.gz |
avcodec/celp_math: avoid overflow in shift
by making gain unsigned we have 1 bit more available
alternatively we can clip twice as in the g729 reference
Fixes: left shift of 23404 by 17 places cannot be represented in type 'int'
Fixes: 61728/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ACELP_KELVIN_fuzzer-6280412547383296
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/celp_math.h')
-rw-r--r-- | libavcodec/celp_math.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/celp_math.h b/libavcodec/celp_math.h index 18888a425d..99a0470719 100644 --- a/libavcodec/celp_math.h +++ b/libavcodec/celp_math.h @@ -78,7 +78,7 @@ int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length); * * @return value << offset, if offset>=0; value >> -offset - otherwise */ -static inline int bidir_sal(int value, int offset) +static inline unsigned bidir_sal(unsigned value, int offset) { if(offset < 0) return value >> -offset; else return value << offset; |