[FFmpeg-cvslog] avcodec/cbs_h265_syntax_template: Limit num_long_term_pics more strictly

Michael Niedermayer git at videolan.org
Thu May 21 15:35:17 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Apr 20 23:27:04 2020 +0200| [435fa373d1f5045b17de74934e44863e2fb3071f] | committer: Michael Niedermayer

avcodec/cbs_h265_syntax_template: Limit num_long_term_pics more strictly

The limit is based on hevcdec.c
Fixes: 20854/clusterfuzz-testcase-minimized-ffmpeg_BSF_HEVC_METADATA_fuzzer-5160442882424832
Fixes: out of array access

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=435fa373d1f5045b17de74934e44863e2fb3071f
---

 libavcodec/cbs_h265_syntax_template.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index 55da1a0a11..06a8e1cc2a 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1377,7 +1377,7 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw,
                     infer(num_long_term_sps, 0);
                     idx_size = 0;
                 }
-                ue(num_long_term_pics, 0, HEVC_MAX_LONG_TERM_REF_PICS);
+                ue(num_long_term_pics, 0, HEVC_MAX_REFS - current->num_long_term_sps);
 
                 for (i = 0; i < current->num_long_term_sps +
                                 current->num_long_term_pics; i++) {



More information about the ffmpeg-cvslog mailing list