avcodec/hevcdec: Check nb_sps
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 14 Jun 2017 23:28:28 +0000 (01:28 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 15 Jun 2017 01:09:40 +0000 (03:09 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/hevcdec.c

index 23a8934..32703f0 100644 (file)
@@ -248,6 +248,8 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb)
         nb_sps = get_ue_golomb_long(gb);
     nb_sh = get_ue_golomb_long(gb);
 
+    if (nb_sps > sps->num_long_term_ref_pics_sps)
+        return AVERROR_INVALIDDATA;
     if (nb_sh + (uint64_t)nb_sps > FF_ARRAY_ELEMS(rps->poc))
         return AVERROR_INVALIDDATA;