[FFmpeg-cvslog] avcodec/scpr: improve motion vectors checking for out of buffer write
Paul B Mahol
git at videolan.org
Fri Feb 24 16:30:18 EET 2017
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Feb 24 15:27:19 2017 +0100| [0a28c505063f0fdbfa24c28dc1e67704e10127b5] | committer: Paul B Mahol
avcodec/scpr: improve motion vectors checking for out of buffer write
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a28c505063f0fdbfa24c28dc1e67704e10127b5
---
libavcodec/scpr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 0802dd4..75e8ffa 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -509,8 +509,8 @@ static int decompress_p(AVCodecContext *avctx,
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++) {
- for (j = 0; j < sx2 - sx1 && (bx + sx1 + j) < avctx->width; j++) {
+ for (i = 0; i < sy2 - sy1 && (by + sy1 + i) < avctx->height && (by + mvy + sy1 + i) < avctx->height; i++) {
+ for (j = 0; j < sx2 - sx1 && (bx + sx1 + j) < avctx->width && (bx + mvx + sx1 + j) < avctx->width; j++) {
dst[(by + i + sy1) * linesize + bx + sx1 + j] = prev[(by + mvy + sy1 + i) * plinesize + bx + sx1 + mvx + j];
}
}
More information about the ffmpeg-cvslog
mailing list