[FFmpeg-devel] [PATCH] make av_set_pts_info more robust
Reimar Döffinger
Reimar.Doeffinger
Wed Jul 1 20:39:50 CEST 2009
Hello,
I don't have a sample file for the issue, but the AVI demuxer and probably
more pass on user data unchecked to av_set_pts_info.
So I propose to change it in a way that will avoid a division by 0.
Not sure if that's the best idea, but it seemed like a good idea (I
originally thought this was the cause of a crash I am investigating).
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 19317)
+++ libavformat/utils.c (working copy)
@@ -3308,8 +3308,10 @@
{
unsigned int gcd= av_gcd(pts_num, pts_den);
s->pts_wrap_bits = pts_wrap_bits;
+ if (pts_num > 0 && pts_den > 0) {
s->time_base.num = pts_num/gcd;
s->time_base.den = pts_den/gcd;
+ }
if(gcd>1)
av_log(NULL, AV_LOG_DEBUG, "st:%d removing common factor %d from timebase\n", s->index, gcd);
More information about the ffmpeg-devel
mailing list