aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Pantelic <vladoman@gmail.com>2013-01-09 17:04:09 +0100
committerLuca Barbato <lu_zero@gentoo.org>2013-01-11 04:57:41 +0100
commit7b8c5b263bc680eff5710bee5994de39d47fc15e (patch)
treeacd6690a31ab216c203e0f711b02ff4d4f8b8aaa
parentae3d41636942cbc0236bad21ad06c65f4eb0f096 (diff)
downloadffmpeg-7b8c5b263bc680eff5710bee5994de39d47fc15e.tar.gz
vc1dec: prevent a crash due missing pred_flag parameter
Handle pred_flag parameter not given to get_mvdata_interlaced() Signed-off-by: Vladimir Pantelic <vladoman@gmail.com> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/vc1dec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index d5d6884a73..c29f91ce11 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -1133,8 +1133,12 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_x = get_bits(gb, v->k_x);
*dmv_y = get_bits(gb, v->k_y);
if (v->numref) {
- *pred_flag = *dmv_y & 1;
- *dmv_y = (*dmv_y + *pred_flag) >> 1;
+ if (pred_flag) {
+ *pred_flag = *dmv_y & 1;
+ *dmv_y = (*dmv_y + *pred_flag) >> 1;
+ } else {
+ *dmv_y = (*dmv_y + (*dmv_y & 1)) >> 1;
+ }
}
}
else {
@@ -1160,7 +1164,7 @@ static av_always_inline void get_mvdata_interlaced(VC1Context *v, int *dmv_x,
*dmv_y = (sign ^ ((val >> 1) + offs_tab[index1 >> v->numref])) - sign;
} else
*dmv_y = 0;
- if (v->numref)
+ if (v->numref && pred_flag)
*pred_flag = index1 & 1;
}
}