[FFmpeg-cvslog] avcodec/mv30: Do not allow MVs outside the allocated image

Michael Niedermayer git at videolan.org
Fri Jun 5 01:05:34 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May 20 21:52:23 2020 +0200| [e73a25168028fea7ca8a837519c6643875c09cab] | committer: Michael Niedermayer

avcodec/mv30: Do not allow MVs outside the allocated image

Fixes: out of array read
Fixes: 21804/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5673678898724864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e73a25168028fea7ca8a837519c6643875c09cab
---

 libavcodec/mv30.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mv30.c b/libavcodec/mv30.c
index 7e67133cf7..658f32c6ff 100644
--- a/libavcodec/mv30.c
+++ b/libavcodec/mv30.c
@@ -545,8 +545,8 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
                 int px = x + mv_x;
                 int py = y + mv_y;
 
-                if (px < 0 || px >= avctx->width ||
-                    py < 0 || py >= avctx->height)
+                if (px < 0 || px > FFALIGN(avctx->width , 16) - 16 ||
+                    py < 0 || py > FFALIGN(avctx->height, 16) - 16)
                     return AVERROR_INVALIDDATA;
 
                 src[0] = prev->data[0] + in_linesize[0] * py + px;



More information about the ffmpeg-cvslog mailing list