eacmv: ensure second-last frame is allocated before referencing it
authorDaniel Kang <daniel.d.kang@gmail.com>
Sun, 9 Jan 2011 08:28:40 +0000 (08:28 +0000)
committerPeter Ross <pross@xvid.org>
Sun, 9 Jan 2011 08:28:40 +0000 (08:28 +0000)
Fixes issue2513
Original patch by Daniel Kang, daniel.d.kang at gmail

Originally committed as revision 26279 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/eacmv.c

index f506f7cc3e0d1e0a883052788ae5308024cc5c66..016b2342437d9d9fa7dd4cacaf568c47d6fc31a1 100644 (file)
@@ -97,6 +97,7 @@ static void cmv_decode_inter(CmvContext * s, const uint8_t *buf, const uint8_t *
             }else if(raw<buf_end) {  /* inter using second-last frame as reference */
                 int xoffset = (*raw & 0xF) - 7;
                 int yoffset = ((*raw >> 4)) - 7;
+                if (s->last2_frame.data[0])
                 cmv_motcomp(s->frame.data[0], s->frame.linesize[0],
                             s->last2_frame.data[0], s->last2_frame.linesize[0],
                             x*4, y*4, xoffset, yoffset, s->avctx->width, s->avctx->height);