Commit 97064019 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpeg12dec: check slice size before trying to decode it

Fixes assertion failure
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 6a64b23d
...@@ -2299,6 +2299,11 @@ static int decode_chunks(AVCodecContext *avctx, ...@@ -2299,6 +2299,11 @@ static int decode_chunks(AVCodecContext *avctx,
if (s2->picture_structure == PICT_BOTTOM_FIELD) if (s2->picture_structure == PICT_BOTTOM_FIELD)
mb_y++; mb_y++;
if (buf_end - buf_ptr < 2) {
av_log(s2->avctx, AV_LOG_ERROR, "slice too small\n");
return AVERROR_INVALIDDATA;
}
if (mb_y >= s2->mb_height) { if (mb_y >= s2->mb_height) {
av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height); av_log(s2->avctx, AV_LOG_ERROR, "slice below image (%d >= %d)\n", mb_y, s2->mb_height);
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment