[FFmpeg-devel] [PATCH] Fix decoding crash on some trashed interlaced MPEG2 streams. This fixes issue 2367.

Måns Rullgård mans
Fri Feb 18 01:47:26 CET 2011


Anatoly Nenashev <anatoly.nenashev at ovsoft.ru> writes:

> From 20e1e656ab07edbfaec5e329a408139720c6b8e7 Mon Sep 17 00:00:00 2001
> From: anatoly <anatoly.nenashev at ovsoft.ru>
> Date: Fri, 18 Feb 2011 01:01:45 +0300
> Subject: [PATCH] Fix decoding crash on some trashed interlaced MPEG2 streams. This fixes issue 2367.
>
> ---
>  libavcodec/mpeg12.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
> index 3c73627..28292ab 100644
> --- a/libavcodec/mpeg12.c
> +++ b/libavcodec/mpeg12.c
> @@ -1763,7 +1763,12 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
>          s->dest[1] +=(16 >> lowres) >> s->chroma_x_shift;
>          s->dest[2] +=(16 >> lowres) >> s->chroma_x_shift;
>
> +        if (s->mb_intra || !field_pic || s->last_picture.data[0] ||
> +            s->first_field || s->picture_structure != s->field_select[0][0] + 1) {

Is it really necessary to do all these checks per MB?

>          MPV_decode_mb(s, s->block);
> +        } else {
> +            av_log(avctx, AV_LOG_ERROR, "Some restrictions for inter prediction are broken, skipping macroblock\n");
> +        }
>
>          if (++s->mb_x >= s->mb_width) {
>              const int mb_size= 16>>s->avctx->lowres;
> -- 
> 1.7.1
>

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list