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
(cherry picked from commit 9eef9eb301)
This commit is contained in:
Anton Khirnov
2013-11-28 10:54:35 +01:00
committed by Sean McGovern
parent b6a0f5cde8
commit 7e513d85e8

View File

@@ -3833,6 +3833,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;