Skip to content

Commit

Permalink
fixed possible undefined shift with broken hevc streams
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Jan 19, 2024
1 parent 5e389b9 commit 5a8404e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/media_tools/av_parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -7312,7 +7312,7 @@ s32 hevc_parse_slice_segment(GF_BitStream *bs, HEVCState *hevc, HEVCSliceInfo *s
}
num_long_term_pics = gf_bs_read_ue_log(bs, "num_long_term_pics");
if (num_long_term_sps+num_long_term_pics>32) return -1;

for (i = 0; i < num_long_term_sps + num_long_term_pics; i++) {
if (i < num_long_term_sps) {
if (sps->num_long_term_ref_pic_sps > 1)
Expand Down Expand Up @@ -8416,6 +8416,8 @@ static s32 gf_hevc_read_sps_bs_internal(GF_BitStream *bs, HEVCState *hevc, u8 la
sps->bitsSliceSegmentAddress = 0;
while (nb_CTUs > (u32)(1 << sps->bitsSliceSegmentAddress)) {
sps->bitsSliceSegmentAddress++;
if (sps->bitsSliceSegmentAddress==31)
return -1;
}

sps->scaling_list_enable_flag = gf_bs_read_int_log(bs, 1, "scaling_list_enable_flag");
Expand Down

0 comments on commit 5a8404e

Please sign in to comment.