Commit ee155c18 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 781efd07
...@@ -566,6 +566,8 @@ static int hvcc_parse_sps(GetBitContext *gb, ...@@ -566,6 +566,8 @@ static int hvcc_parse_sps(GetBitContext *gb,
if (get_bits1(gb)) { // long_term_ref_pics_present_flag if (get_bits1(gb)) { // long_term_ref_pics_present_flag
unsigned num_long_term_ref_pics_sps = get_ue_golomb_long(gb); unsigned num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
if (num_long_term_ref_pics_sps > 31U)
return AVERROR_INVALIDDATA;
for (i = 0; i < num_long_term_ref_pics_sps; i++) { // num_long_term_ref_pics_sps for (i = 0; i < num_long_term_ref_pics_sps; i++) { // num_long_term_ref_pics_sps
int len = FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16); int len = FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
skip_bits (gb, len); // lt_ref_pic_poc_lsb_sps[i] skip_bits (gb, len); // lt_ref_pic_poc_lsb_sps[i]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment