[FFmpeg-devel] [PATCH] Fix crash in MJEG decoder

Diego Santa Cruz Diego.SantaCruz
Fri Jun 27 16:36:59 CEST 2008


Hi there,

I have a JPEG file which segfaults the MJPEG decoder.

This file has 4 color components (YCCK I believe, color transform 2 in the Adobe APP14 marker) with no subsampling.

The problem is that ff_mjpeg_decode_sof() sets the pixel format to PIX_FMT_GRAY8 and thus allocates only one component. Then mjpeg_decode_scan() decodes the MBs and tries to perform the IDCT on a non-allocated component which triggers a segfault.

The attached patch fixes the problem by simply skipping the IDCT step in mjpeg_decode_scan() when the corresponding component is not allocated.

The decoded image will not be correct anyhow, but it can be considered a best attempt to decode an unhandled color space and prevents ffmpeg from crashing.

Tested on SVN HEAD with

ffmpeg -i celgene.jpg test.avi

I can provide the troublesome file if required (680K).

Comments welcome.

--
--------------------------------------------------------------------------

Diego Santa Cruz, PhD
Technology Architect, SpinetiX S.A.

PSE-C, CH-1015, Lausanne, Switzerland
Tel:??? +41 (0) 21 693 89 81
Mail:?? Diego.SantaCruz at spinetix.com

Get Information : http://www.spinetix.com

--------------------------------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg-jpeg-4.patch
Type: application/octet-stream
Size: 865 bytes
Desc: ffmpeg-jpeg-4.patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080627/3a22c3e5/attachment.obj>



More information about the ffmpeg-devel mailing list