[FFmpeg-devel] [PATCH] MJPEG check that dc_index and ac_index have a VLC table associated

Reimar Döffinger Reimar.Doeffinger
Sat Jul 4 14:57:25 CEST 2009


On Sat, Jul 04, 2009 at 02:08:33PM +0200, Michael Niedermayer wrote:
> On Sat, Jul 04, 2009 at 11:14:12AM +0200, Reimar D?ffinger wrote:
> > On Sat, Jul 04, 2009 at 11:11:22AM +0200, Reimar D?ffinger wrote:
> > > this fixes from issue 1240 mjpeg/smclockmjpeg.avi.1.171
> > > The problem is that the vlc tables 2 and 3 are only initialized if they
> > > are stored in the file, thus causing a NULL dereference when they are
> > > used otherwise.
> > > I think just checking for a valid VLC table is the most reliable way to
> > > fix this, like this:
> > > Index: libavcodec/mjpegdec.c
> > > ===================================================================
> > > --- libavcodec/mjpegdec.c       (revision 19334)
> > > +++ libavcodec/mjpegdec.c       (working copy)
> > > @@ -922,24 +923,8 @@
> > >          if (s->dc_index[i] <  0 || s->ac_index[i] < 0 ||
> > >              s->dc_index[i] >= 4 || s->ac_index[i] >= 4)
> > >              goto out_of_range;
> > > -#if 0 //buggy
> > > -        switch(s->start_code)
> > > -        {
> > > -            case SOF0:
> > > -                if (dc_index[i] > 1 || ac_index[i] > 1)
> > > -                    goto out_of_range;
> > > -                break;
> > > -            case SOF1:
> > > -            case SOF2:
> > > -                if (dc_index[i] > 3 || ac_index[i] > 3)
> > > -                    goto out_of_range;
> > > -                break;
> > > -            case SOF3:
> > > -                if (dc_index[i] > 3 || ac_index[i] != 0)
> > > -                    goto out_of_range;
> > > -                break;
> > > -        }
> > > -#endif
> > > +        if (!s->vlcs[0][s->dc_index[i]].table || !s->vlcs[1][s->dc_index[i]].table)
> > 
> > With that typo fixed (should be ac_index in the second case), it fixes
> > mjpeg/smclockmjpeg.avi.1.10, too.
> 
> patch ok

Great, applied.



More information about the ffmpeg-devel mailing list