diff mbox series

[FFmpeg-devel] avcodec/h264_picture: wait for the second slice to apply film grain on interlaced content

Message ID 20210914125902.2114-1-jamrial@gmail.com
State Accepted
Commit 5d5ab3b4e68109f216467866d193182eb8e41386
Headers show
Series [FFmpeg-devel] avcodec/h264_picture: wait for the second slice to apply film grain on interlaced content | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

James Almer Sept. 14, 2021, 12:59 p.m. UTC
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>
---
 libavcodec/h264_picture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Sept. 14, 2021, 4:30 p.m. UTC | #1
On Tue, Sep 14, 2021 at 09:59:02AM -0300, James Almer wrote:
> 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>
> ---
>  libavcodec/h264_picture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

works

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 5944798394..66fd9bc4cb 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -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,