summaryrefslogtreecommitdiff
path: root/libavformat/hevc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-08-24 13:04:38 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-08-24 13:04:38 +0200
commitee155c18a2c50b339ba5f6f223fbb6dc343fd471 (patch)
tree2f711a5824ab7f1d0e9b643bd38fdd9751856e1d /libavformat/hevc.c
parent781efd07415cdf6f676cca5b22147e5d6be0a4c4 (diff)
avformat/hevc: Check num_long_term_ref_pics_sps to avoid potentially long loops
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/hevc.c')
-rw-r--r--libavformat/hevc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index dc765ab94b..7c294ef8a2 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -566,6 +566,8 @@ static int hvcc_parse_sps(GetBitContext *gb,
if (get_bits1(gb)) { // long_term_ref_pics_present_flag
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
int len = FFMIN(log2_max_pic_order_cnt_lsb_minus4 + 4, 16);
skip_bits (gb, len); // lt_ref_pic_poc_lsb_sps[i]