ffmpeg | branch: release/4.4 | Michael Niedermayer <mich...@niedermayer.cc> | 
Sat Dec 30 03:06:39 2023 +0100| [6337710681a5259fe53b8721f2acdc9a8b6a91c5] | 
committer: Michael Niedermayer

avcodec/mpegvideo_enc: Dont copy beyond the image

Fixes: out of array access
Fixes: tickets/10754/poc17ffmpeg

Discovered by Zeng Yunxiang.

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit a066b8a809fa6d8b31398d41787822803f8762f2)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

 libavcodec/mpegvideo_enc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index cee3fdb36b..04c5503c9a 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1278,7 +1278,7 @@ static int load_input_picture(MpegEncContext *s, const 
AVFrame *pic_arg)
                         dst += INPLACE_OFFSET;
 
                     if (src_stride == dst_stride)
-                        memcpy(dst, src, src_stride * h);
+                        memcpy(dst, src, src_stride * h - src_stride + w);
                     else {
                         int h2 = h;
                         uint8_t *dst2 = dst;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to