aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-12 19:28:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-01 23:25:20 +0200
commitf30ab69b38324d156f0511c2c59a4f0d232c2b88 (patch)
treea3e4214fcce5a06abbb4666273f235fc56e7c07c
parentce3bb011197dfa6d3b8d8a65b7cc6a8f079e82ac (diff)
downloadffmpeg-f30ab69b38324d156f0511c2c59a4f0d232c2b88.tar.gz
avformat/hevc: Check num_negative_pics and num_positive_pics
Fixes CID1238994 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit b62b3292d8e25d3240e462c1b1cd8ac69195c46b) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/hevc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index 8ef3c1f986..c92e9eb118 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -462,6 +462,9 @@ static int parse_rps(GetBitContext *gb, unsigned int rps_idx,
unsigned int num_negative_pics = get_ue_golomb_long(gb);
unsigned int num_positive_pics = get_ue_golomb_long(gb);
+ if ((num_positive_pics + (uint64_t)num_negative_pics) * 2 > get_bits_left(gb))
+ return AVERROR_INVALIDDATA;
+
num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
for (i = 0; i < num_negative_pics; i++) {