diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-12-24 20:27:54 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-12-24 20:27:54 +0100 |
commit | fc5c49ab3247533e0a5cb203cf7122143389eb5c (patch) | |
tree | 3a0e9eb1780640b655ccb5de4efc0a1590392c03 /libavcodec/mpeg4videodec.c | |
parent | 43abef9fde0cf87153cc9031cad61f75b02cfa01 (diff) | |
download | ffmpeg-fc5c49ab3247533e0a5cb203cf7122143389eb5c.tar.gz |
mpeg4videodec: Fix division by zero in mpeg4_decode_sprite_trajectory()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpeg4videodec.c')
-rw-r--r-- | libavcodec/mpeg4videodec.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index de5e862827..b57395ae8f 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -160,7 +160,7 @@ static inline int mpeg4_is_resync(MpegEncContext *s){ return 0; } -static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb) +static int mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb) { int i; int a= 2<<s->sprite_warping_accuracy; @@ -176,6 +176,9 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb int h= s->height; int min_ab; + if(w<=0 || h<=0) + return -1; + for(i=0; i<s->num_sprite_warping_points; i++){ int length; int x=0, y=0; @@ -348,6 +351,7 @@ static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb } s->real_sprite_warping_points= s->num_sprite_warping_points; } + return 0; } /** @@ -411,7 +415,8 @@ int mpeg4_decode_video_packet_header(MpegEncContext *s) skip_bits(&s->gb, 3); /* intra dc vlc threshold */ //FIXME don't just ignore everything if(s->pict_type == AV_PICTURE_TYPE_S && s->vol_sprite_usage==GMC_SPRITE){ - mpeg4_decode_sprite_trajectory(s, &s->gb); + if(mpeg4_decode_sprite_trajectory(s, &s->gb) < 0) + return -1; av_log(s->avctx, AV_LOG_ERROR, "untested\n"); } @@ -2051,7 +2056,8 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ } if(s->pict_type == AV_PICTURE_TYPE_S && (s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE)){ - mpeg4_decode_sprite_trajectory(s, gb); + if(mpeg4_decode_sprite_trajectory(s, gb) < 0) + return -1; if(s->sprite_brightness_change) av_log(s->avctx, AV_LOG_ERROR, "sprite_brightness_change not supported\n"); if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "static sprite not supported\n"); } |