aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-22 15:22:35 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:20 +0200
commitc5a26f45119845bf87cd2c178a4b2bd70329f5cb (patch)
tree0bd60a9f81703b19ff1f19124d8caaa74e6b4638
parent752fa02287065c757b9b0e75708c6a52c2ea62a2 (diff)
downloadffmpeg-c5a26f45119845bf87cd2c178a4b2bd70329f5cb.tar.gz
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@niedermayer.cc> (cherry picked from commit 87d87e6587deec1fa8ed5f5c6901535becdb0358) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/mpegvideo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 6d5deed754..e9a28e0af1 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1071,6 +1071,13 @@ int ff_mpv_common_frame_size_change(MpegEncContext *s)
(err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
goto fail;
+ /* 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)))
goto fail;