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

Michael Niedermayer michaelni
Sat Jul 4 14:08:33 CEST 2009


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

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090704/1394387d/attachment.pgp>



More information about the ffmpeg-devel mailing list