lavc/vda_h264_dec.c Fix NULL pointer dereference

ps.sps_list entries may be NULL, so check before dereferencing

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Pavel Koshevoy 2017-02-09 20:20:14 -07:00 committed by Michael Niedermayer
parent 5ef2f4f394
commit e3f1b99334
1 changed files with 1 additions and 1 deletions

View File

@ -226,7 +226,7 @@ static av_cold int vdadec_init(AVCodecContext *avctx)
ctx->h264_initialized = 1; ctx->h264_initialized = 1;
for (i = 0; i < MAX_SPS_COUNT; i++) { for (i = 0; i < MAX_SPS_COUNT; i++) {
const SPS *sps = (const SPS*)ctx->h264ctx.ps.sps_list[i]->data; const SPS *sps = ctx->h264ctx.ps.sps_list[i] ? (const SPS*)ctx->h264ctx.ps.sps_list[i]->data : NULL;
if (sps && (sps->bit_depth_luma != 8 || if (sps && (sps->bit_depth_luma != 8 ||
sps->chroma_format_idc == 2 || sps->chroma_format_idc == 2 ||
sps->chroma_format_idc == 3)) { sps->chroma_format_idc == 3)) {