[FFmpeg-devel] [PATCH] mjpegdec: ensure SOF before SOS/EOI
Sat Jul 4 19:42:11 CEST 2009
On Fri, Jul 03, 2009 at 04:42:15PM +0200, Reimar D?ffinger wrote:
> On Wed, Jul 01, 2009 at 10:15:22PM +0200, Reimar D?ffinger wrote:
> > this fixes issue1240, mjpeg/smclockmjpeg.avi.1.0
> > The problem is, it reaches EOI before SOF, thus get_buffer was
> > never called and the picture it returns has invalid values for
> > data (NULL in this case, but it could be values from a previous
> > frame which still would be wrong).
> > This could also happen, if avcodec_check_dimensions failed, which
> > might make this even more of an issue.
> > Attached patch fixes it and also protects the decode_sos part so
> > it will only be called with a valid picture.
> Any objections?
> As a second step I suggest extending the code as in attached patch.
> This allows to decode JPEGs that have a misplaced EOI somewhere too
> early, decodes images that lack an EOI marker and most importantly
> makes the decoder fail and return -1 when the parsed data is complete
> gibberish (no e.g. no SOF at all).
> AFAICT currently when you pass random data to the MJPEG decoder it will
> basically say "hey, everything's fine, I just don't have any decoded
> data yet" which IMO is inappropriate.
all fine, i assume you split this a little before commit ...
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Old school: Use the lowest level language in which you can solve the problem
New school: Use the highest level language in which the latest supercomputer
can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
More information about the ffmpeg-devel