aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hevc_refs.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-05-25 23:40:19 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-06-18 14:29:13 +0200
commit6f2cf88771bd8c3986b0c8b6404eabc5b37d8a6e (patch)
treea15be86c8cbb98426cbda591fa20c3eee5649848 /libavcodec/hevc_refs.c
parenta0f4d4e65093a4cb627f05d09b19c922e88cfac1 (diff)
downloadffmpeg-6f2cf88771bd8c3986b0c8b6404eabc5b37d8a6e.tar.gz
avcodec/hevc_refs: Check that nb_refs stays <= HEVC_MAX_REFS
Fixes: 58528/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5834725318328320 Fixes: index 16 out of bounds for type 'int [16]' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hevc_refs.c')
-rw-r--r--libavcodec/hevc_refs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c
index a4af6ca656..3aa8e19950 100644
--- a/libavcodec/hevc_refs.c
+++ b/libavcodec/hevc_refs.c
@@ -354,7 +354,7 @@ int ff_hevc_slice_rpl(HEVCContext *s)
}
}
// Construct RefPicList0, RefPicList1 (8-8, 8-10)
- if (s->ps.pps->pps_curr_pic_ref_enabled_flag) {
+ if (s->ps.pps->pps_curr_pic_ref_enabled_flag && rpl_tmp.nb_refs < HEVC_MAX_REFS) {
rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc;
rpl_tmp.ref[rpl_tmp.nb_refs] = s->ref;
rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1;