summaryrefslogtreecommitdiff
path: root/libavcodec/vp9dsp_template.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-06-22 00:24:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-09-05 17:48:59 +0200
commitd182d8f10cf69c59ef9c21df4b06e5478df063ef (patch)
tree4ba05515d163bb44917a7a1715b71a13a7bd35fb /libavcodec/vp9dsp_template.c
parentcf0c700b0c25f5d9fe50dd27086a06812822f11a (diff)
downloadffmpeg-d182d8f10cf69c59ef9c21df4b06e5478df063ef.tar.gz
avcodec/vp9dsp_template: Fix integer overflow in iadst8_1d()
Fixes: signed integer overflow: 998938090 + 1169275991 cannot be represented in type 'int' Fixes: 23411/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VP9_fuzzer-4644692330545152 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/vp9dsp_template.c')
-rw-r--r--libavcodec/vp9dsp_template.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/vp9dsp_template.c b/libavcodec/vp9dsp_template.c
index c6944f5ce3..8d00e77d70 100644
--- a/libavcodec/vp9dsp_template.c
+++ b/libavcodec/vp9dsp_template.c
@@ -1260,20 +1260,20 @@ static av_always_inline void iadst8_1d(const dctcoef *in, ptrdiff_t stride,
t6 = (t2a - t6a + (1 << 13)) >> 14;
t7 = (t3a - t7a + (1 << 13)) >> 14;
- t4a = 15137 * t4 + 6270 * t5;
- t5a = 6270 * t4 - 15137 * t5;
- t6a = 15137 * t7 - 6270 * t6;
- t7a = 6270 * t7 + 15137 * t6;
+ t4a = 15137U * t4 + 6270U * t5;
+ t5a = 6270U * t4 - 15137U * t5;
+ t6a = 15137U * t7 - 6270U * t6;
+ t7a = 6270U * t7 + 15137U * t6;
out[0] = t0 + t2;
out[7] = -(t1 + t3);
t2 = t0 - t2;
t3 = t1 - t3;
- out[1] = -((t4a + t6a + (1 << 13)) >> 14);
- out[6] = (t5a + t7a + (1 << 13)) >> 14;
- t6 = (t4a - t6a + (1 << 13)) >> 14;
- t7 = (t5a - t7a + (1 << 13)) >> 14;
+ out[1] = -((dctint)((1U << 13) + t4a + t6a) >> 14);
+ out[6] = (dctint)((1U << 13) + t5a + t7a) >> 14;
+ t6 = (dctint)((1U << 13) + t4a - t6a) >> 14;
+ t7 = (dctint)((1U << 13) + t5a - t7a) >> 14;
out[3] = -(((t2 + t3) * 11585 + (1 << 13)) >> 14);
out[4] = ((t2 - t3) * 11585 + (1 << 13)) >> 14;