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

Anatoly Nenashev anatoly.nenashev
Fri Feb 18 10:13:49 CET 2011


On 18.02.2011 03:47, M?ns Rullg?rd wrote:
> 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?
>    
>

You are right. Checks for "field_pic", "s->last_picture.data[0]", 
"s->first_field" can be done outside the loop. Changed patch in attachment.




More information about the ffmpeg-devel mailing list