eacmv: Make sure a reference frame exists before referencing it
authorMartin Storsjö <martin@martin.st>
Mon, 16 Sep 2013 18:07:30 +0000 (21:07 +0300)
committerMartin Storsjö <martin@martin.st>
Tue, 17 Sep 2013 08:33:38 +0000 (11:33 +0300)
This is similar to an existing check for the second-last frame
from 062421e3.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/eacmv.c

index cf19a85..6236bd2 100644 (file)
@@ -120,9 +120,10 @@ static void cmv_decode_inter(CmvContext *s, AVFrame *frame, const uint8_t *buf,
         }else{  /* inter using last frame as reference */
             int xoffset = (buf[i] & 0xF) - 7;
             int yoffset = ((buf[i] >> 4)) - 7;
-            cmv_motcomp(frame->data[0], frame->linesize[0],
-                      s->last_frame->data[0], s->last_frame->linesize[0],
-                      x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
+            if (s->last_frame->data[0])
+                cmv_motcomp(frame->data[0], frame->linesize[0],
+                            s->last_frame->data[0], s->last_frame->linesize[0],
+                            x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);
         }
         i++;
     }