]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mjpegdec.c
fraps: release reference buffer on pix_fmt change.
[ffmpeg] / libavcodec / mjpegdec.c
index 8e9f3f3d452f3949ef6fa73fe7aa1f33d6dd2488..47a85cb59818c887d8774c846eddfb91195d5fb4 100644 (file)
@@ -90,7 +90,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
         s->picture_ptr = &s->picture;
 
     s->avctx = avctx;
-    dsputil_init(&s->dsp, avctx);
+    ff_dsputil_init(&s->dsp, avctx);
     ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
     s->buffer_size   = 0;
     s->buffer        = NULL;
@@ -1458,6 +1458,10 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         /* EOF */
         if (start_code < 0) {
             goto the_end;
+        } else if (unescaped_buf_size > (1U<<29)) {
+            av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n",
+                   start_code, unescaped_buf_ptr, buf_size);
+            return AVERROR_INVALIDDATA;
         } else {
             av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
                    start_code, buf_end - buf_ptr);