[FFmpeg-cvslog] avcodec/scpr: improve check for out of range motion vectors

Paul B Mahol git at videolan.org
Thu Feb 23 20:47:25 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 23 19:45:12 2017 +0100| [45ed942e7e166b288b6f1c262292df6a47295f6a] | committer: Paul B Mahol

avcodec/scpr: improve check for out of range motion vectors

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavcodec/scpr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 319057c..5555d81 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -504,7 +504,8 @@ static int decompress_p(AVCodecContext *avctx,
                 mvx -= 256;
                 mvy -= 256;
 
-                if (by + mvy + sy1 < 0 || bx + mvx + sx1 < 0)
+                if (by + mvy + sy1 < 0 || bx + mvx + sx1 < 0 ||
+                    by + mvy + sy1 >= avctx->height || bx + mvx + sx1 >= avctx->width)
                     return AVERROR_INVALIDDATA;
 
                 for (i = 0; i < sy2 - sy1 && (by + sy1 + i) < avctx->height; i++) {



More information about the ffmpeg-cvslog mailing list