aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-16 16:17:12 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-06-26 21:26:41 +0200
commit507ca66ee41aa8a95b75654163f77af0a99a25b1 (patch)
tree0457ce2ce9e2a7e09b333439d1b666988ba9b75f
parentebccd2f778a861b41ad38a8464ea120d4f16b2d7 (diff)
downloadffmpeg-507ca66ee41aa8a95b75654163f77af0a99a25b1.tar.gz
avcodec/vc1dsp: Avoid undefined shifts in vc1_v_s_overlap_c / vc1_h_s_overlap_c
Fixes: left shift of negative value -13 Fixes: 15260/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VC1_fuzzer-5702076048343040 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/vc1dsp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index 778b811f1a..c25a6f3adf 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -95,10 +95,10 @@ static void vc1_v_s_overlap_c(int16_t *top, int16_t *bottom)
d1 = a - d;
d2 = a - d + b - c;
- top[48] = ((a << 3) - d1 + rnd1) >> 3;
- top[56] = ((b << 3) - d2 + rnd2) >> 3;
- bottom[0] = ((c << 3) + d2 + rnd1) >> 3;
- bottom[8] = ((d << 3) + d1 + rnd2) >> 3;
+ top[48] = ((a * 8) - d1 + rnd1) >> 3;
+ top[56] = ((b * 8) - d2 + rnd2) >> 3;
+ bottom[0] = ((c * 8) + d2 + rnd1) >> 3;
+ bottom[8] = ((d * 8) + d1 + rnd2) >> 3;
bottom++;
top++;
@@ -122,10 +122,10 @@ static void vc1_h_s_overlap_c(int16_t *left, int16_t *right, int left_stride, in
d1 = a - d;
d2 = a - d + b - c;
- left[6] = ((a << 3) - d1 + rnd1) >> 3;
- left[7] = ((b << 3) - d2 + rnd2) >> 3;
- right[0] = ((c << 3) + d2 + rnd1) >> 3;
- right[1] = ((d << 3) + d1 + rnd2) >> 3;
+ left[6] = ((a * 8) - d1 + rnd1) >> 3;
+ left[7] = ((b * 8) - d2 + rnd2) >> 3;
+ right[0] = ((c * 8) + d2 + rnd1) >> 3;
+ right[1] = ((d * 8) + d1 + rnd2) >> 3;
right += right_stride;
left += left_stride;