summaryrefslogtreecommitdiff
path: root/libavcodec/eacmv.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-16 21:07:30 +0300
committerMartin Storsjö <martin@martin.st>2013-09-17 11:33:38 +0300
commitea78a348d86a3a733f6c1e0a65cfdd8283d924b9 (patch)
tree8826e78590db67224faef044fd761687507ae13e /libavcodec/eacmv.c
parentc39f7eba01cd656e8f0eed592f93d11814736650 (diff)
eacmv: Make sure a reference frame exists before referencing it
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>
Diffstat (limited to 'libavcodec/eacmv.c')
-rw-r--r--libavcodec/eacmv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c
index cf19a85e5a..6236bd2dd1 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -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++;
}