[FFmpeg-cvslog] avcodec/mpegvideo: Update chroma_?_shift in ff_mpv_common_frame_size_change()

Michael Niedermayer git at videolan.org
Thu Apr 1 12:49:59 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Mon Mar 22 15:22:35 2021 +0100| [ac0e9506d00c55f77b236486d76d839e8f508991] | committer: Michael Niedermayer

avcodec/mpegvideo: Update chroma_?_shift in ff_mpv_common_frame_size_change()

Fixes: out of array access
Fixes: 31201/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG4_fuzzer-4627865612189696.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 87d87e6587deec1fa8ed5f5c6901535becdb0358)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mpegvideo.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 988dd18a33..728e591958 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1069,6 +1069,13 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s)
         (err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
         return err;
 
+    /* set chroma shifts */
+    err = av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+                                           &s->chroma_x_shift,
+                                           &s->chroma_y_shift);
+    if (err < 0)
+        return err;
+
     if ((err = init_context_frame(s)))
         return err;
 



More information about the ffmpeg-cvslog mailing list