avcodec/h264_picture: wait for the second slice to apply film grain on interlaced content

Fixes: Assertion failure
Fixes: clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6581961297100800

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2021-09-14 09:47:32 -03:00
parent e67deaf86c
commit 5d5ab3b4e6

View File

@ -250,7 +250,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
if (err < 0)
av_log(avctx, AV_LOG_ERROR,
"hardware accelerator failed to decode picture\n");
} else if (!in_setup && cur->needs_fg) {
} else if (!in_setup && cur->needs_fg && (!FIELD_PICTURE(h) || !h->first_field)) {
AVFrameSideData *sd = av_frame_get_side_data(cur->f, AV_FRAME_DATA_FILM_GRAIN_PARAMS);
av_assert0(sd); // always present if `cur->needs_fg`
err = ff_h274_apply_film_grain(cur->f_grain, cur->f, &h->h274db,