Prevent NULL dereferences when missing the reference frame in the Electronic Arts...
authorLaurent Aimar <fenrir@videolan.org>
Fri, 30 Sep 2011 22:45:00 +0000 (00:45 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 1 Oct 2011 19:03:26 +0000 (21:03 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 113d7be62497c4e59db8f224fdb7f0a90cf17d03)

libavcodec/eacmv.c

index 35701ca..6e3b519 100644 (file)
@@ -110,9 +110,10 @@ static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *
         }else{  /* inter using last frame as reference */
             int xoffset = (buf[i] & 0xF) - 7;
             int yoffset = ((buf[i] >> 4)) - 7;
-            cmv_motcomp(s->frame.data[0], s->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(s->frame.data[0], s->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++;
     }