[FFmpeg-cvslog] avcodec/mpegvideo_enc: Do not duplicate pictures on shifting
Michael Niedermayer
git at videolan.org
Wed Jul 24 17:50:16 EEST 2024
ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Thu Jun 20 00:44:08 2024 +0200| [0e2bff1a88a51ba7a78dd7b067a9eb4551f65656] | committer: Michael Niedermayer
avcodec/mpegvideo_enc: Do not duplicate pictures on shifting
Fixes: out of array access
Fixes: 69098/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG2VIDEO_fuzzer-6107989688778752
Fixes: 69599/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4848626296225792.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 9c8881cb3534b257d6e6539f563006599cd96b48)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0e2bff1a88a51ba7a78dd7b067a9eb4551f65656
---
libavcodec/mpegvideo_enc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 623450e93d..d42f2db862 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1297,6 +1297,8 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
/* shift buffer entries */
for (i = flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++)
s->input_picture[i - flush_offset] = s->input_picture[i];
+ for (int i = MAX_B_FRAMES + 1 - flush_offset; i <= MAX_B_FRAMES; i++)
+ s->input_picture[i] = NULL;
s->input_picture[encoding_delay] = (Picture*) pic;
More information about the ffmpeg-cvslog
mailing list