1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2023-05-25 23:40:19 +02:00
parent a0f4d4e650
commit 6f2cf88771
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -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;