Opened 5 years ago

Closed 5 years ago

#834 closed defect (fixed)

jpeg doesn't decode correctly

Reported by: ami_stuff Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: mjpeg regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

New Revision: 19341

Log:
mjpegdec: check that the coded dc_index and ac_index have a valid associated VLC table.
Removes some disabled dc_index/ac_index checking code that seems to have had
some undocumented issues and should not really be necessary anymore now.
Fixes from issue 1240 the files mjpeg/smclockmjpeg.avi.1.10 and mjpeg/smclockmjpeg.avi.1.171.

Modified:
   trunk/libavcodec/mjpegdec.c

Modified: trunk/libavcodec/mjpegdec.c
==============================================================================
--- trunk/libavcodec/mjpegdec.c	Sat Jul  4 10:18:03 2009	(r19340)
+++ trunk/libavcodec/mjpegdec.c	Sat Jul  4 14:54:36 2009	(r19341)
@@ -922,24 +922,8 @@ int ff_mjpeg_decode_sos(MJpegDecodeConte
         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->ac_index[i]].table)
+            goto out_of_range;
     }
 
     predictor= get_bits(&s->gb, 8); /* JPEG Ss / lossless JPEG predictor /JPEG-LS NEAR */
C:\>ffmpeg -i 123.jpg h.bmp
ffmpeg version N-36088-gdd1fb65, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 22 2011 12:39:23 with gcc 4.6.2
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru
ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope
ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en
able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      51. 32.100 / 51. 32.100
  libavcodec     53. 47.100 / 53. 47.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 53.  0 /  2. 53.  0
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  0.100
  libpostproc    51.  2.100 / 51.  2.100
[mjpeg @ 02645B60] decode_sos: ac/dc index out of range
    Last message repeated 1 times
Input #0, image2, from '123.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p, 736x584 [SAR 28:28 DAR 92:73], 25 tbr,
25 tbn, 25 tbc
Incompatible pixel format 'yuvj420p' for codec 'bmp', auto-selecting format 'bgr
24'
[buffer @ 020F18C0] w:736 h:584 pixfmt:yuvj420p tb:1/1000000 sar:28/28 sws_param
:
[buffersink @ 020F1B40] auto-inserting filter 'auto-inserted scale 0' between th
e filter 'src' and the filter 'out'
[scale @ 020F1FC0] w:736 h:584 fmt:yuvj420p -> w:736 h:584 fmt:bgr24 flags:0x4
Output #0, image2, to 'h.bmp':
  Metadata:
    encoder         : Lavf53.28.100
    Stream #0:0: Video: bmp, bgr24, 736x584 [SAR 1:1 DAR 92:73], q=2-31, 200 kb/
s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> bmp)
Press [q] to stop, [?] for help
[mjpeg @ 02645B60] decode_sos: ac/dc index out of range
    Last message repeated 1 times
frame=    1 fps=  0 q=0.0 Lsize=       0kB time=00:00:00.04 bitrate=   0.0kbits/
s
video:1259kB audio:0kB global headers:0kB muxing overhead -100.000000%

Attachments (1)

123.jpg (285.0 KB) - added by ami_stuff 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by ami_stuff

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords mjpeg regression added
  • Priority changed from normal to important
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from unspecified to git-master

comment:2 Changed 5 years ago by michael

  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.