Commit efbc614d authored by Michael Niedermayer's avatar Michael Niedermayer

check time_base.den for mpeg4

avoid zero time_base.* for h263

Originally committed as revision 4483 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 2f300f89
...@@ -5156,6 +5156,7 @@ int h263_decode_picture_header(MpegEncContext *s) ...@@ -5156,6 +5156,7 @@ int h263_decode_picture_header(MpegEncContext *s)
s->avctx->time_base.num*= get_bits(&s->gb, 7); s->avctx->time_base.num*= get_bits(&s->gb, 7);
if(s->avctx->time_base.num == 0){ if(s->avctx->time_base.num == 0){
av_log(s, AV_LOG_ERROR, "zero framerate\n"); av_log(s, AV_LOG_ERROR, "zero framerate\n");
s->avctx->time_base= (AVRational){1001, 30000}; //prevent crash
return -1; return -1;
} }
gcd= ff_gcd(s->avctx->time_base.den, s->avctx->time_base.num); gcd= ff_gcd(s->avctx->time_base.den, s->avctx->time_base.num);
...@@ -5538,6 +5539,10 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ ...@@ -5538,6 +5539,10 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){
check_marker(gb, "before time_increment_resolution"); check_marker(gb, "before time_increment_resolution");
s->avctx->time_base.den = get_bits(gb, 16); s->avctx->time_base.den = get_bits(gb, 16);
if(!s->avctx->time_base.den){
av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n");
return -1;
}
s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1;
if (s->time_increment_bits < 1) if (s->time_increment_bits < 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment