[FFmpeg-devel] [PATCH] Off by one in mpeg video parsing (r17731)

Baptiste Coudurier baptiste.coudurier
Sat May 16 06:06:15 CEST 2009


On Tue, May 05, 2009 at 01:53:18AM +0200, Michael Niedermayer wrote:
> On Mon, May 04, 2009 at 08:47:11PM -0000, Wolfram Gloger wrote:
> > Hi,
> > 
> > I believe r17731 introduced an off-by-one error.
> > It introduced in mpeg12.c:
> > 
> > @@ -2244,6 +2244,9 @@
> >                      return i-3;
> >                  }
> >              }
> > +            if(s && state == PICTURE_START_CODE){
> > +                ff_fetch_timestamp(s, i-4, 1);
> > +            }
> >          }
> >      }
> >      pc->state= state;
> > 
> > however, as is apparent from the surrounding code, the index that
> > "points" to PICTURE_START_CODE is actually i-3 and not i-4.
> > The effect of this is that when a PES packet starts with
> > PICTURE_START_CODE (very common e.g. in DVB), the timestamps
> > are fetched from the _previous_ PES packet (offset==-1),
> > which is wrong IMHO.
> 
> a reproducable testcase would be nice
> 

I'm trying to find one, but I can confirm that the patch fixes the
issue, when the TS demuxer is modified to output PES packets.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA    
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list