summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-12-30 03:06:39 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2023-12-30 21:50:04 +0100
commita066b8a809fa6d8b31398d41787822803f8762f2 (patch)
treeb71173cc41ae652c8fae1c450d64c0f97440c88c
parent68146f06f852078866b3ef1564556e3a272920c7 (diff)
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 <michael@niedermayer.cc>
-rw-r--r--libavcodec/mpegvideo_enc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index dcbf4c0429..b369c3c735 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1212,7 +1212,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;