h264: check that execute_decode_slices() is not called too many times

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
This commit is contained in:
Anton Khirnov 2013-11-28 10:54:35 +01:00 committed by Reinhard Tartler
parent 0f71a5df4b
commit 7f33a24e82

View File

@ -3818,6 +3818,12 @@ static int execute_decode_slices(H264Context *h, int context_count){
H264Context *hx;
int i;
if (s->mb_y >= s->mb_height) {
av_log(s->avctx, AV_LOG_ERROR,
"Input contains more MB rows than the frame height.\n");
return AVERROR_INVALIDDATA;
}
if (s->avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
return 0;
if(context_count == 1) {