aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-22 17:55:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-20 14:21:24 +0100
commitad7c1ed262fb2faf13ac6a1b23136fd85606d75d (patch)
tree02a89ede9647692dda11373b6d5f0a26c5821b98
parent9797f8dba3424c893bfaae72936f1c1def8d9205 (diff)
downloadffmpeg-ad7c1ed262fb2faf13ac6a1b23136fd85606d75d.tar.gz
avcodec/vp9dsp_template: Fix integer overflows in itxfm_wrapper
Fixes: signed integer overflow: 2147483641 + 32 cannot be represented in type 'int' Fixes: 27452/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-5078752576667648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4dfb7ff528c02afbafba14676c139ecb82164c44) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vp9dsp_template.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/vp9dsp_template.c b/libavcodec/vp9dsp_template.c
index 3acf94c583..9b11661704 100644
--- a/libavcodec/vp9dsp_template.c
+++ b/libavcodec/vp9dsp_template.c
@@ -1138,7 +1138,7 @@ static void type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
for (j = 0; j < sz; j++) \
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
(bits ? \
- (t + (1 << (bits - 1))) >> bits : \
+ (int)(t + (1U << (bits - 1))) >> bits : \
t)); \
dst++; \
} \
@@ -1153,7 +1153,7 @@ static void type_a##_##type_b##_##sz##x##sz##_add_c(uint8_t *_dst, \
for (j = 0; j < sz; j++) \
dst[j * stride] = av_clip_pixel(dst[j * stride] + \
(bits ? \
- (out[j] + (1 << (bits - 1))) >> bits : \
+ (int)(out[j] + (1U << (bits - 1))) >> bits : \
out[j])); \
dst++; \
} \