summaryrefslogtreecommitdiff
path: root/libavcodec/agm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-12-16 23:09:04 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-28 11:20:48 +0100
commit1f2096945709a32315da740691b5716da55893c3 (patch)
treec594bf68b1593f36dd7c6e8e461cc1ccb2f15de0 /libavcodec/agm.c
parentbf5c850b795126d4f60dd9498c06f0492f5726a7 (diff)
downloadffmpeg-1f2096945709a32315da740691b5716da55893c3.tar.gz
avcodec/agm: Include block size in the MV check for flags == 3
Fixes: out of array read Fixes: 19331/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AGM_fuzzer-5644115983466496 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/agm.c')
-rw-r--r--libavcodec/agm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/agm.c b/libavcodec/agm.c
index 628f324913..80f4697ee5 100644
--- a/libavcodec/agm.c
+++ b/libavcodec/agm.c
@@ -423,8 +423,8 @@ static int decode_inter_plane(AGMContext *s, GetBitContext *gb, int size,
int map = s->map[x];
if (orig_mv_x >= -32) {
- if (y * 8 + mv_y < 0 || y * 8 + mv_y >= h ||
- x * 8 + mv_x < 0 || x * 8 + mv_x >= w)
+ if (y * 8 + mv_y < 0 || y * 8 + mv_y + 8 >= h ||
+ x * 8 + mv_x < 0 || x * 8 + mv_x + 8 >= w)
return AVERROR_INVALIDDATA;
copy_block8(frame->data[plane] + (s->blocks_h - 1 - y) * 8 * frame->linesize[plane] + x * 8,