[FFmpeg-devel] [PATCH 3/3] avcodec/hevcdec: Fix null dereference in hevc_frame_end()

Michael Niedermayer michael at niedermayer.cc
Mon Apr 1 05:00:06 EEST 2024


Fixes: member access within null pointer of type 'const AVFilmGrainParams' (aka 'const struct AVFilmGrainParams')
Fixes: 67701/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6595117570916352

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/hevcdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 752459af2d3..2514d522ba5 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2945,6 +2945,8 @@ static int hevc_frame_end(HEVCContext *s)
     if (out->needs_fg) {
         av_assert0(out->frame_grain->buf[0]);
         fgp = av_film_grain_params_select(out->frame);
+        if (!fgp)
+            return 0;
         switch (fgp->type) {
         case AV_FILM_GRAIN_PARAMS_NONE:
             av_assert0(0);
-- 
2.17.1



More information about the ffmpeg-devel mailing list