]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/4xm.c
mpeg12: disable checked reader.
[ffmpeg] / libavcodec / 4xm.c
index e6638c7b4b3b51a2bd03b3f24a266f589ca57054..f854f1cfb581cb196be7009bed089023b75f19d9 100644 (file)
@@ -459,6 +459,11 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
 static int decode_i_block(FourXContext *f, DCTELEM *block){
     int code, i, j, level, val;
 
+    if(get_bits_left(&f->gb) < 2){
+        av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb));
+        return -1;
+    }
+
     /* DC coef */
     val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
     if (val>>4){
@@ -821,7 +826,7 @@ static int decode_frame(AVCodecContext *avctx,
 
     avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
 
-    p->reference= 1;
+    p->reference= 3;
     if (avctx->reget_buffer(avctx, p) < 0) {
         av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
         return -1;
@@ -841,7 +846,7 @@ static int decode_frame(AVCodecContext *avctx,
         }
     }else if(frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")){
         if(!f->last_picture.data[0]){
-            f->last_picture.reference= 1;
+            f->last_picture.reference= 3;
             if(avctx->get_buffer(avctx, &f->last_picture) < 0){
                 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
                 return -1;