aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-28 03:46:56 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-12-08 19:08:30 +0100
commit4fde30ba9d050443fb14116fb206d0d37092bed0 (patch)
treefd1a7d1c486db8ed05b2ce1b1d7c4a4b9bfe846d /libavcodec
parenta06432b6c315fda5a9cc69059fd106d231e7da6c (diff)
downloadffmpeg-4fde30ba9d050443fb14116fb206d0d37092bed0.tar.gz
avcodec/hevc_ps: Check num_long_term_ref_pics_sps
Fixes out of array access Fixes: signal_sigsegv_35bd0f0_1182_cov_791726764_STRUCT_B_Samsung_4.bit Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit ea38e5a6b75706477898eb1e6582d667dbb9946c) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc_ps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index c8350fb90f..53b27bda3b 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -843,6 +843,11 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
sps->long_term_ref_pics_present_flag = get_bits1(gb);
if (sps->long_term_ref_pics_present_flag) {
sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
+ if (sps->num_long_term_ref_pics_sps > 31U) {
+ av_log(0, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n",
+ sps->num_long_term_ref_pics_sps);
+ goto err;
+ }
for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb);
sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb);