[FFmpeg-devel] [PATCH 3/5] avcodec/hevc/hevcdec: SPS not set (or cleared) after frame start

Michael Niedermayer michael at niedermayer.cc
Mon Jun 24 02:01:35 EEST 2024


Fixes: NULL pointer dereference
Fixes: 69623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-6549698459009024

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/hevc/hevcdec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index d68d454537a..4dd84d4953c 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3180,6 +3180,9 @@ static int decode_slice(HEVCContext *s, const H2645NAL *nal, GetBitContext *gb)
     } else if (!s->cur_frame) {
         av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");
         return AVERROR_INVALIDDATA;
+    } else if (!s->ps.sps) {
+        av_log(s->avctx, AV_LOG_ERROR, "sps not set in slice.\n");
+        return AVERROR_INVALIDDATA;
     }
 
     if (s->nal_unit_type != s->first_nal_type) {
-- 
2.45.2



More information about the ffmpeg-devel mailing list