1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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 87d87e6587)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-03-22 15:22:35 +01:00
parent e6d3ace07e
commit 9689bc0c5c

View File

@ -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) (err = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0)
goto fail; 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))) if ((err = init_context_frame(s)))
goto fail; goto fail;