aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-16 21:07:30 +0300
committerLuca Barbato <lu_zero@gentoo.org>2013-10-04 03:26:26 +0200
commit2e12af4587613dd5b2c3431e5c8194d73b03434f (patch)
treeb03857c2aa364c80eecda899676275ae24b8cdd1
parentc8c93795e4afd04c2c5b74e29e8dec29b6a76b81 (diff)
downloadffmpeg-2e12af4587613dd5b2c3431e5c8194d73b03434f.tar.gz
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> (cherry picked from commit ea78a348d86a3a733f6c1e0a65cfdd8283d924b9) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Conflicts: 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 0dce066f1e..b7e13b1114 100644
--- a/libavcodec/eacmv.c
+++ b/libavcodec/eacmv.c
@@ -108,9 +108,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++;
}