[FFmpeg-devel] [PATCH 2/2] avcodec/hevc_ps: Dont leave invalid cpb_cnt_minus1 in the context

Michael Niedermayer michael at niedermayer.cc
Wed Oct 18 03:49:35 EEST 2023


Fixes: index 32 out of bounds for type 'uint32_t [32]'
Fixes: 63003/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-4685160840560640

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_ps.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index a6b64b92e3..f4365ef5b5 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -421,6 +421,7 @@ static int decode_hrd(GetBitContext *gb, int common_inf_present,
             if (hdr->cpb_cnt_minus1[i] > 31) {
                 av_log(NULL, AV_LOG_ERROR, "nb_cpb %d invalid\n",
                        hdr->cpb_cnt_minus1[i]);
+                hdr->cpb_cnt_minus1[i] = 0;
                 return AVERROR_INVALIDDATA;
             }
         }
-- 
2.17.1



More information about the ffmpeg-devel mailing list