aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2013-08-05 06:27:12 +0200
committerLuca Barbato <lu_zero@gentoo.org>2013-08-24 16:17:41 +0200
commit937cedd7c0ca98d183ceaf650f0dad1aab1b75a5 (patch)
tree1c514d5967baa844445059e41984e8602a7bd6e5
parentc5ba226c1b0b76c1e7fad17a1448b793240671f6 (diff)
downloadffmpeg-937cedd7c0ca98d183ceaf650f0dad1aab1b75a5.tar.gz
vc1: check the source buffer in vc1_mc functions
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org (cherry picked from commit 090cd0631140ac1a3a795d2adfac5dbf5e381aa2) Signed-off-by: Luca Barbato <lu_zero@gentoo.org> Conflicts: libavcodec/vc1dec.c
-rw-r--r--libavcodec/vc1dec.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index c29f91ce11..e24a15380e 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -394,6 +394,11 @@ static void vc1_mc_1mv(VC1Context *v, int dir)
}
}
+ if (!srcY || !srcU) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "Referenced frame missing.\n");
+ return;
+ }
+
src_x = s->mb_x * 16 + (mx >> 2);
src_y = s->mb_y * 16 + (my >> 2);
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
@@ -569,6 +574,11 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir)
} else
srcY = s->next_picture.f.data[0];
+ if (!srcY) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "Referenced frame missing.\n");
+ return;
+ }
+
if (v->field_mode) {
if (v->cur_field_type != v->ref_field_type[dir])
my = my - 2 + 4 * v->cur_field_type;
@@ -856,6 +866,11 @@ static void vc1_mc_4mv_chroma(VC1Context *v, int dir)
srcV = s->next_picture.f.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
}
+ if (!srcU) {
+ av_log(v->s.avctx, AV_LOG_ERROR, "Referenced frame missing.\n");
+ return;
+ }
+
if (v->field_mode) {
if (chroma_ref_type) {
srcU += s->current_picture_ptr->f.linesize[1];