Skip to content

Commit

Permalink
hevc: check that VPS referenced from SPS exists
Browse files Browse the repository at this point in the history
This matches how its done for SPS/PPS.
Fixes null pointer dereference.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
  • Loading branch information
michaelni authored and lu-zero committed Jan 21, 2014
1 parent dd2d003 commit a7a07cc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libavcodec/hevc_ps.c
Expand Up @@ -633,6 +633,13 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
goto err;
}

if (!s->vps_list[sps->vps_id]) {
av_log(s->avctx, AV_LOG_ERROR, "VPS %d does not exist\n",
sps->vps_id);
ret = AVERROR_INVALIDDATA;
goto err;
}

sps->max_sub_layers = get_bits(gb, 3) + 1;
if (sps->max_sub_layers > MAX_SUB_LAYERS) {
av_log(s->avctx, AV_LOG_ERROR, "sps_max_sub_layers out of range: %d\n",
Expand Down

0 comments on commit a7a07cc

Please sign in to comment.