diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-26 03:14:08 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-03-26 23:19:49 +0100 |
commit | 1eb8cbd09c5f22d7ba9e0d443712a6ab80648637 (patch) | |
tree | 634b0642f53579f62c739234a5d8c85f36bfc8a7 /libavcodec | |
parent | 6009dd07bd2bde72f2e01723678c1994ecef035e (diff) | |
download | ffmpeg-1eb8cbd09c5f22d7ba9e0d443712a6ab80648637.tar.gz |
avcodec/wavarc: avoid signed integer overflow in AC code
Fixes: 62285/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVARC_fuzzer-659847401740697
Fixes: signed integer overflow: 65312 * 34078 cannot be represented in type 'int'
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')
-rw-r--r-- | libavcodec/wavarc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/wavarc.c b/libavcodec/wavarc.c index 99cbaf0109..aa1af6330b 100644 --- a/libavcodec/wavarc.c +++ b/libavcodec/wavarc.c @@ -414,7 +414,7 @@ static int ac_init(AVCodecContext *avctx, static uint16_t ac_get_prob(WavArcContext *s) { - return ((s->freq_range - 1) + (s->ac_value - s->ac_low) * s->freq_range) / + return ((s->freq_range - 1) + (s->ac_value - s->ac_low) * (unsigned)s->freq_range) / ((s->ac_high - s->ac_low) + 1U); } @@ -439,8 +439,8 @@ static int ac_normalize(AVCodecContext *avctx, WavArcContext *s, GetBitContext * goto fail; range = (s->ac_high - s->ac_low) + 1; - s->ac_high = (range * s->range_high) / s->freq_range + s->ac_low - 1; - s->ac_low += (range * s->range_low) / s->freq_range; + s->ac_high = (range * (unsigned)s->range_high) / s->freq_range + s->ac_low - 1; + s->ac_low += (range * (unsigned)s->range_low) / s->freq_range; if (s->ac_high < s->ac_low) goto fail; |