aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/wmv2.c
diff options
context:
space:
mode:
authorMichael Niedermayer2005-08-04 22:46:27 +0000
committerMichael Niedermayer2005-08-04 22:46:27 +0000
commit804b0dac587a3979ed17c1ef1d24a7fe363ecaf0 (patch)
tree72af2e92e683f4c45b987befe534d0b9b94821ed /libavcodec/wmv2.c
parentd2f820a5cd8f1ea0807fd56f2c1759068c5397b0 (diff)
segfault fix
Originally committed as revision 4491 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/wmv2.c')
-rw-r--r--libavcodec/wmv2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c
index e03a0a2d4d..75e924cb67 100644
--- a/libavcodec/wmv2.c
+++ b/libavcodec/wmv2.c
@@ -513,9 +513,12 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
B = s->current_picture.motion_val[0][xy - wrap];
C = s->current_picture.motion_val[0][xy + 2 - wrap];
- diff= FFMAX(ABS(A[0] - B[0]), ABS(A[1] - B[1]));
+ if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
+ diff= FFMAX(ABS(A[0] - B[0]), ABS(A[1] - B[1]));
+ else
+ diff=0;
- if(s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag && diff >= 8)
+ if(diff >= 8)
type= get_bits1(&s->gb);
else
type= 2;