workaround apps which dont provided correctly padded streams
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Nov 2004 20:49:12 +0000 (20:49 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 19 Nov 2004 20:49:12 +0000 (20:49 +0000)
Originally committed as revision 3695 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mjpeg.c

index 6f1b908..d281b06 100644 (file)
@@ -1832,9 +1832,9 @@ static int mjpeg_decode_frame(AVCodecContext *avctx,
                        *(dst++) = x;
                        if (x == 0xff)
                        {
-                           while(*src == 0xff) src++;
+                            while(src<buf_end && x == 0xff)
+                                x = *(src++);
 
-                           x = *(src++);
                            if (x >= 0xd0 && x <= 0xd7)
                                *(dst++) = x;
                            else if (x)