Fix illegal memory access when stream starts w/ invisible frame.

Add a check to make sure we have a decoded frame available
before copying its 'corrupt' flag.

(Originally submitted to the old repository by Alexander Voronov
as: https://gerrit.chromium.org/gerrit/#/c/74305/).

Change-Id: Iceb4686c785afb437b668015bf8818b18d60e0ce
This commit is contained in:
Adrian Grange 2015-05-14 15:44:50 -07:00
parent 65b768fdf9
commit f480c1256d

View File

@ -937,7 +937,8 @@ static vpx_codec_err_t ctrl_get_frame_corrupted(vpx_codec_alg_priv_t *ctx,
frame_worker_data->pbi->common.buffer_pool->frame_bufs;
if (frame_worker_data->pbi->common.frame_to_show == NULL)
return VPX_CODEC_ERROR;
*corrupted = frame_bufs[ctx->last_show_frame].buf.corrupted;
if (ctx->last_show_frame >= 0)
*corrupted = frame_bufs[ctx->last_show_frame].buf.corrupted;
return VPX_CODEC_OK;
} else {
return VPX_CODEC_ERROR;