aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-04-27 15:10:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2017-08-23 13:15:17 +0200
commit2fd6441fe4d58416075b4fbc572eb37bbcf6469b (patch)
treed96a47f9248a611968748e1a0983b2cf70b07f92
parent880a06bd4f88407eb5fc42e973c0a982562ebd7a (diff)
downloadffmpeg-2fd6441fe4d58416075b4fbc572eb37bbcf6469b.tar.gz
avcodec/svq3: Increase offsets to prevent integer overflows
Fixes: 1280/clusterfuzz-testcase-minimized-6102353767825408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 382b4fc9b5f3102f59743bf9c8619b31dd8ede1b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/svq3.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 9459329058..3e90450d4a 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -433,8 +433,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
int fx, fy;
mx = (mx + 1 >> 1) + dx;
my = (my + 1 >> 1) + dy;
- fx = (unsigned)(mx + 0x3000) / 3 - 0x1000;
- fy = (unsigned)(my + 0x3000) / 3 - 0x1000;
+ fx = (unsigned)(mx + 0x30000) / 3 - 0x10000;
+ fy = (unsigned)(my + 0x30000) / 3 - 0x10000;
dxy = (mx - 3 * fx) + 4 * (my - 3 * fy);
svq3_mc_dir_part(s, x, y, part_width, part_height,
@@ -442,8 +442,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
mx += mx;
my += my;
} else if (mode == HALFPEL_MODE || mode == PREDICT_MODE) {
- mx = (unsigned)(mx + 1 + 0x3000) / 3 + dx - 0x1000;
- my = (unsigned)(my + 1 + 0x3000) / 3 + dy - 0x1000;
+ mx = (unsigned)(mx + 1 + 0x30000) / 3 + dx - 0x10000;
+ my = (unsigned)(my + 1 + 0x30000) / 3 + dy - 0x10000;
dxy = (mx & 1) + 2 * (my & 1);
svq3_mc_dir_part(s, x, y, part_width, part_height,
@@ -451,8 +451,8 @@ static inline int svq3_mc_dir(SVQ3Context *s, int size, int mode,
mx *= 3;
my *= 3;
} else {
- mx = (unsigned)(mx + 3 + 0x6000) / 6 + dx - 0x1000;
- my = (unsigned)(my + 3 + 0x6000) / 6 + dy - 0x1000;
+ mx = (unsigned)(mx + 3 + 0x60000) / 6 + dx - 0x10000;
+ my = (unsigned)(my + 3 + 0x60000) / 6 + dy - 0x10000;
svq3_mc_dir_part(s, x, y, part_width, part_height,
mx, my, 0, 0, dir, avg);